summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-29 15:20:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-29 15:20:12 (GMT)
commit1645895629e813e4fbabf9d91e4b6077827ebab0 (patch)
treee0740646c5e683c241d4444fd0e756fd45a773ef /generic
parentad7deae63486dd51cf1b388dbb095d0f0419aa34 (diff)
downloadtcl-1645895629e813e4fbabf9d91e4b6077827ebab0.zip
tcl-1645895629e813e4fbabf9d91e4b6077827ebab0.tar.gz
tcl-1645895629e813e4fbabf9d91e4b6077827ebab0.tar.bz2
Eliminate ListSizeT_MAX, since it's the same as TCL_SIZE_MAX
Diffstat (limited to 'generic')
-rwxr-xr-xgeneric/tclArithSeries.c2
-rw-r--r--generic/tclInt.h12
-rw-r--r--generic/tclListObj.c10
3 files changed, 7 insertions, 17 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c
index 0419841..632943a 100755
--- a/generic/tclArithSeries.c
+++ b/generic/tclArithSeries.c
@@ -349,7 +349,7 @@ TclNewArithSeriesObj(
}
}
- if (TCL_MAJOR_VERSION < 9 && len > ListSizeT_MAX) {
+ if (len > TCL_SIZE_MAX) {
Tcl_SetObjResult(
interp,
Tcl_NewStringObj("max length of a Tcl list exceeded", -1));
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 1481b5c..2d3a0fc 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2440,16 +2440,6 @@ typedef enum TclEolTranslation {
#define TCL_INVOKE_NO_UNKNOWN (1<<1)
#define TCL_INVOKE_NO_TRACEBACK (1<<2)
-#if TCL_MAJOR_VERSION > 8
-/*
- * SSIZE_MAX, NOT SIZE_MAX as negative differences need to be expressed
- * between values of the Tcl_Size type so limit the range to signed
- */
-# define ListSizeT_MAX ((Tcl_Size)PTRDIFF_MAX)
-#else
-# define ListSizeT_MAX INT_MAX
-#endif
-
/*
* ListStore --
*
@@ -2490,7 +2480,7 @@ typedef struct ListStore {
/* Max number of elements that can be contained in a list */
#define LIST_MAX \
- ((Tcl_Size)(((size_t)ListSizeT_MAX - offsetof(ListStore, slots)) \
+ ((Tcl_Size)(((size_t)TCL_SIZE_MAX - offsetof(ListStore, slots)) \
/ sizeof(Tcl_Obj *)))
/* Memory size needed for a ListStore to hold numSlots_ elements */
#define LIST_SIZE(numSlots_) \
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index a850695..bb13961 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -2101,12 +2101,12 @@ Tcl_ListObjReplace(
}
if (numToDelete < 0) {
numToDelete = 0;
- } else if (first > ListSizeT_MAX - numToDelete /* Handle integer overflow */
+ } else if (first > LIST_MAX - numToDelete /* Handle integer overflow */
|| origListLen < first + numToDelete) {
numToDelete = origListLen - first;
}
- if (numToInsert > ListSizeT_MAX - (origListLen - numToDelete)) {
+ if (numToInsert > LIST_MAX - (origListLen - numToDelete)) {
return ListLimitExceededError(interp);
}
@@ -2567,7 +2567,7 @@ TclLindexList(
* see TIP#22 and TIP#33 for the details.
*/
if (!TclHasInternalRep(argObj, &tclListType)
- && TclGetIntForIndexM(NULL, argObj, ListSizeT_MAX - 1, &index)
+ && TclGetIntForIndexM(NULL, argObj, TCL_SIZE_MAX - 1, &index)
== TCL_OK) {
/*
* argPtr designates a single index.
@@ -2693,7 +2693,7 @@ TclLindexFlat(
while (++i < indexCount) {
if (TclGetIntForIndexM(
- interp, indexArray[i], ListSizeT_MAX - 1, &index)
+ interp, indexArray[i], TCL_SIZE_MAX - 1, &index)
!= TCL_OK) {
Tcl_DecrRefCount(sublistCopy);
return NULL;
@@ -2758,7 +2758,7 @@ TclLsetList(
*/
if (!TclHasInternalRep(indexArgObj, &tclListType)
- && TclGetIntForIndexM(NULL, indexArgObj, ListSizeT_MAX - 1, &index)
+ && TclGetIntForIndexM(NULL, indexArgObj, TCL_SIZE_MAX - 1, &index)
== TCL_OK) {
/* indexArgPtr designates a single index. */
/* 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 */