summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-07-27 16:21:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-07-27 16:21:59 (GMT)
commitaf346e6e708b6ad252de5e9ecd38f110eb43990f (patch)
tree0db38812d7480c695014625ea1d409a58f83618c /generic/tclListObj.c
parentf5ba1ba55f0504211b8be88049a0298c6e29ad80 (diff)
parent25b5f03d7a8f8c50e31c2498d9b9fef6e48c51f5 (diff)
downloadtcl-af346e6e708b6ad252de5e9ecd38f110eb43990f.zip
tcl-af346e6e708b6ad252de5e9ecd38f110eb43990f.tar.gz
tcl-af346e6e708b6ad252de5e9ecd38f110eb43990f.tar.bz2
merge tip-625
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r--generic/tclListObj.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 9025dc9..cb9310a 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -12,8 +12,11 @@
#include "tclInt.h"
#include <assert.h>
-/* TODO - memmove is fast. Measure at what size we should prefer memmove
- (for unshared objects only) in lieu of range operations */
+/*
+ * TODO - memmove is fast. Measure at what size we should prefer memmove
+ * (for unshared objects only) in lieu of range operations. On the other
+ * hand, more cache dirtied?
+ */
/*
* Macros for validation and bug checking.
@@ -1440,7 +1443,7 @@ ListRepRange(
if (!preserveSrcRep) {
/* T:listrep-1.{4,5,8,9},2.{4:7},3.{15:18},4.{7,8} */
ListRepFreeUnreferenced(srcRepPtr);
- }
+ } /* else T:listrep-2.{4.2,4.3,5.2,5.3,6.2,7.2,8.1} */
if (rangeStart == TCL_INDEX_NONE) {
rangeStart = 0;
@@ -1475,7 +1478,7 @@ ListRepRange(
*/
if (rangeStart == 0 && rangeEnd == (numSrcElems-1)) {
/* Option 0 - entire list. This may be used to canonicalize */
- /* T:listrep-1.10.1 */
+ /* T:listrep-1.10.1,2.8.1 */
*rangeRepPtr = *srcRepPtr; /* Not ref counts not incremented */
} else if (rangeStart == 0 && (!preserveSrcRep)
&& (!ListRepIsShared(srcRepPtr) && srcRepPtr->spanPtr == NULL)) {
@@ -1502,7 +1505,7 @@ ListRepRange(
if (!preserveSrcRep && srcRepPtr->spanPtr
&& srcRepPtr->spanPtr->refCount <= 1) {
/* If span is not shared reuse it */
- /* T:listrep-3.{16,18} */
+ /* T:listrep-2.7.3,3.{16,18} */
srcRepPtr->spanPtr->spanStart = spanStart;
srcRepPtr->spanPtr->spanLength = rangeLen;
*rangeRepPtr = *srcRepPtr;
@@ -1625,7 +1628,7 @@ TclListObjRange(
ListRepRange(&listRep, rangeStart, rangeEnd, isShared, &resultRep);
if (isShared) {
- /* T:listrep-1.10.1 */
+ /* T:listrep-1.10.1,2.{4.2,4.3,5.2,5.3,6.2,7.2,8.1} */
TclNewObj(listObj);
} /* T:listrep-1.{4.3,5.1,5.2} */
ListObjReplaceRepAndInvalidate(listObj, &resultRep);
@@ -1835,7 +1838,7 @@ Tcl_ListObjAppendList(
LIST_ASSERT(listRep.spanPtr->spanStart
== listRep.storePtr->firstUsed);
listRep.spanPtr->spanLength = finalLen;
- }
+ } /* else T:listrep-3.6.3 */
LIST_ASSERT(ListRepStart(&listRep) == listRep.storePtr->firstUsed);
LIST_ASSERT(ListRepLength(&listRep) == finalLen);
LISTREP_CHECK(&listRep);
@@ -2168,7 +2171,7 @@ Tcl_ListObjReplace(
if (numToDelete == 0) {
/* Case (2a) - Append to list. */
if (first == origListLen) {
- /* T:listrep-1.11,2.9,3.{5,6} */
+ /* T:listrep-1.11,2.9,3.{5,6},2.2.1 */
return TclListObjAppendElements(
interp, listObj, numToInsert, insertObjs);
}
@@ -2729,7 +2732,7 @@ TclLsetList(
&& TclGetIntForIndexM(NULL, indexArgObj, ListSizeT_MAX - 1, &index)
== TCL_OK) {
/* indexArgPtr designates a single index. */
- /* T:listrep-1.{2.1,12.1,15.1,19.1} */
+ /* T:listrep-1.{2.1,12.1,15.1,19.1},2.{2.3,9.3,10.1,13.1,16.1}, 3.{4,5,6}.3 */
return TclLsetFlat(interp, listObj, 1, &indexArgObj, valueObj);
}
@@ -3012,13 +3015,13 @@ TclLsetFlat(
len = -1;
TclListObjLengthM(NULL, subListObj, &len);
if (valueObj == NULL) {
- /* T:listrep-1.{4.2,5.4,6.1,7.1,8.3} */
+ /* T:listrep-1.{4.2,5.4,6.1,7.1,8.3},2.{4,5}.4 */
Tcl_ListObjReplace(NULL, subListObj, index, 1, 0, NULL);
} else if (index == len) {
- /* T:listrep-1.2.1 */
+ /* T:listrep-1.2.1,2.{2.3,9.3},3.{4,5,6}.3 */
Tcl_ListObjAppendElement(NULL, subListObj, valueObj);
} else {
- /* T:listrep-1.{12.1,15.1,19.1} */
+ /* T:listrep-1.{12.1,15.1,19.1},2.{10,13,16}.1 */
TclListObjSetElement(NULL, subListObj, index, valueObj);
TclInvalidateStringRep(subListObj);
}
@@ -3091,6 +3094,7 @@ TclListObjSetElement(
/* Replace a shared internal rep with an unshared copy */
if (listRep.storePtr->refCount > 1) {
ListRep newInternalRep;
+ /* T:listrep-2.{10,13,16}.1 */
/* TODO - leave extra space? */
ListRepClone(&listRep, &newInternalRep, LISTREP_PANIC_ON_FAIL);
listRep = newInternalRep;