Tcl Source Code

Artifact [f8c74addbc]
Login

Artifact f8c74addbcda4aa6a556c48d34e66274d23771da:

Attachment "shimmer.patch" to ticket [738900ffff] added by dgp 2003-05-17 01:13:44.
Index: generic/tclListObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclListObj.c,v
retrieving revision 1.13
diff -u -r1.13 tclListObj.c
--- generic/tclListObj.c	7 Jan 2002 23:09:13 -0000	1.13
+++ generic/tclListObj.c	16 May 2003 18:06:47 -0000
@@ -1518,6 +1518,18 @@
 
     elemPtrs = (Tcl_Obj **)
 	    ckalloc((unsigned) (estCount * sizeof(Tcl_Obj *)));
+    if ((estCount == 1) && (length > 0) && (objPtr->typePtr != NULL)) {
+
+	result = TclFindElement(interp, string, length, &elemStart,
+		&nextElem, &elemSize, &hasBrace);
+	if (result != TCL_OK) {
+	    ckfree((char *) elemPtrs);
+	    return result;
+	}
+	i = 1;
+	elemPtrs[0] = Tcl_DuplicateObj(objPtr);
+	Tcl_IncrRefCount(elemPtrs[0]);
+    } else {
     for (p = string, lenRemain = length, i = 0;
 	    lenRemain > 0;
 	    p = nextElem, lenRemain = (limit - nextElem), i++) {
@@ -1556,6 +1568,7 @@
         elemPtr->length = elemSize;
         elemPtrs[i] = elemPtr;
 	Tcl_IncrRefCount(elemPtr); /* since list now holds ref to it */
+    }
     }
 
     listRepPtr = (List *) ckalloc(sizeof(List));