summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-03-02 16:06:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-03-02 16:06:32 (GMT)
commit986970a95155cda5c067008629993af20bd86e52 (patch)
treef9f063c96e5318002932be73d790641f69af4fd4 /generic/tclListObj.c
parent7fe6552f08334298693e15b6a8b53f8cd27ff2c4 (diff)
downloadtcl-986970a95155cda5c067008629993af20bd86e52.zip
tcl-986970a95155cda5c067008629993af20bd86e52.tar.gz
tcl-986970a95155cda5c067008629993af20bd86e52.tar.bz2
Added comments warning against certain optimizations
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r--generic/tclListObj.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 35db836..6887207 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclListObj.c,v 1.35 2007/02/24 18:55:43 dgp Exp $
+ * RCS: @(#) $Id: tclListObj.c,v 1.36 2007/03/02 16:06:33 dgp Exp $
*/
#include "tclInt.h"
@@ -804,6 +804,14 @@ Tcl_ListObjReplace(
}
}
+ /*
+ * Note that when count == 0 and objc == 0, this routine is logically
+ * a no-op, removing and adding no elements to the list. However, by
+ * flowing through this routine anyway, we get the important side effect
+ * that the resulting listPtr is a list in canoncial form. This is
+ * important. Resist any temptation to optimize this case.
+ */
+
listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
elemPtrs = &listRepPtr->elements;
numElems = listRepPtr->elemCount;