summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-07-20 20:39:16 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-07-20 20:39:16 (GMT)
commit5ad954783e49a00f738e29083586df9f8c9411e0 (patch)
tree2f1a39f07a885096fcc38d486e03c00f399508fd
parenta7a2c2e589efa82857ba0a2526acede975aa89d0 (diff)
downloadtcl-5ad954783e49a00f738e29083586df9f8c9411e0.zip
tcl-5ad954783e49a00f738e29083586df9f8c9411e0.tar.gz
tcl-5ad954783e49a00f738e29083586df9f8c9411e0.tar.bz2
Stop internals intrusion into lists.
-rw-r--r--generic/tclExecute.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index f1205b0..a2a465a 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5283,23 +5283,10 @@ TEBCresume(
toIdx = objc-1;
}
if (fromIdx == 0 && toIdx != objc-1 && !Tcl_IsShared(valuePtr)) {
- /*
- * BEWARE! This is looking inside the implementation of the
- * list type.
- */
-
- List *listPtr = valuePtr->internalRep.twoPtrValue.ptr1;
-
- if (listPtr->refCount == 1) {
- for (index=toIdx+1; index<objc ; index++) {
- TclDecrRefCount(objv[index]);
- }
- listPtr->elemCount = toIdx+1;
- listPtr->canonicalFlag = 1;
- TclInvalidateStringRep(valuePtr);
- TRACE_APPEND(("%.30s\n", O2S(valuePtr)));
- NEXT_INST_F(9, 0, 0);
- }
+ Tcl_ListObjReplace(interp, valuePtr,
+ toIdx + 1, LIST_MAX, 0, NULL);
+ TRACE_APPEND(("%.30s\n", O2S(valuePtr)));
+ NEXT_INST_F(9, 0, 0);
}
objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, objv+fromIdx);
} else {