summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-06-08 10:23:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-06-08 10:23:13 (GMT)
commit8ef685ede6f3371073dfb6f84eff77b62398787c (patch)
treefd4894d3b57bc034901dff8f04b0b9b465057ce1 /generic/tclUtil.c
parentaa312430e34a7bd58cddb79b7dd6840e86ced518 (diff)
parentbdccbf1c921b2158d107e97cc64b72ab81a05ee5 (diff)
downloadtcl-8ef685ede6f3371073dfb6f84eff77b62398787c.zip
tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.gz
tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.bz2
TIP #616: Tcl lists > 2^31 elements
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 8c2485e..17a9dfe 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -99,15 +99,15 @@ static ProcessGlobalValue executableName = {
*/
static void ClearHash(Tcl_HashTable *tablePtr);
-static void FreeProcessGlobalValue(ClientData clientData);
-static void FreeThreadHash(ClientData clientData);
+static void FreeProcessGlobalValue(void *clientData);
+static void FreeThreadHash(void *clientData);
static int GetEndOffsetFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t endValue, Tcl_WideInt *indexPtr);
static Tcl_HashTable * GetThreadHash(Tcl_ThreadDataKey *keyPtr);
static int GetWideForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t endValue, Tcl_WideInt *widePtr);
static int FindElement(Tcl_Interp *interp, const char *string,
- int stringLength, const char *typeStr,
+ size_t stringLength, const char *typeStr,
const char *typeCode, const char **elementPtr,
const char **nextPtr, size_t *sizePtr,
int *literalPtr);
@@ -521,7 +521,7 @@ TclFindDictElement(
* containing a Tcl dictionary with zero or
* more keys and values (possibly in
* braces). */
- int dictLength, /* Number of bytes in the dict's string. */
+ size_t dictLength, /* Number of bytes in the dict's string. */
const char **elementPtr, /* Where to put address of first significant
* character in the first element (i.e., key
* or value) of dict. */
@@ -550,7 +550,7 @@ FindElement(
* containing a Tcl list or dictionary with
* zero or more elements (possibly in
* braces). */
- int stringLength, /* Number of bytes in the string. */
+ size_t stringLength1, /* Number of bytes in the string. */
const char *typeStr, /* The name of the type of thing we are
* parsing, for error messages. */
const char *typeCode, /* The type code for thing we are parsing, for
@@ -578,6 +578,7 @@ FindElement(
size_t numChars;
int literal = 1;
const char *p2;
+ int stringLength = stringLength1;
/*
* Skim off leading white space and check for an opening brace or quote.
@@ -844,20 +845,21 @@ TclCopyAndCollapse(
*----------------------------------------------------------------------
*/
+#undef Tcl_SplitList
int
Tcl_SplitList(
Tcl_Interp *interp, /* Interpreter to use for error reporting. If
* NULL, no error message is left. */
const char *list, /* Pointer to string with list structure. */
- int *argcPtr, /* Pointer to location to fill in with the
+ size_t *argcPtr, /* Pointer to location to fill in with the
* number of elements in the list. */
const char ***argvPtr) /* Pointer to place to store pointer to array
* of pointers to list elements. */
{
const char **argv, *end, *element;
char *p;
- int length, size, i, result;
- size_t elSize;
+ int result;
+ size_t length, size, i, elSize;
/*
* Allocate enough space to work in. A (const char *) for each (possible)
@@ -1558,13 +1560,12 @@ TclConvertElement(
char *
Tcl_Merge(
- int argc, /* How many strings to merge. */
+ size_t argc, /* How many strings to merge. */
const char *const *argv) /* Array of string values. */
{
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
- int i;
- size_t bytesNeeded = 0;
+ size_t i, bytesNeeded = 0;
char *result, *dst;
/*
@@ -1847,11 +1848,10 @@ TclTrim(
char *
Tcl_Concat(
- int argc, /* Number of strings to concatenate. */
+ size_t argc, /* Number of strings to concatenate. */
const char *const *argv) /* Array of strings to concatenate. */
{
- int i;
- size_t needSpace = 0, bytesNeeded = 0;
+ size_t i, needSpace = 0, bytesNeeded = 0;
char *result, *p;
/*
@@ -1937,11 +1937,11 @@ Tcl_Concat(
Tcl_Obj *
Tcl_ConcatObj(
- int objc, /* Number of objects to concatenate. */
+ size_t objc, /* Number of objects to concatenate. */
Tcl_Obj *const objv[]) /* Array of objects to concatenate. */
{
- int i, needSpace = 0;
- size_t bytesNeeded = 0, elemLength;
+ int needSpace = 0;
+ size_t i, bytesNeeded = 0, elemLength;
const char *element;
Tcl_Obj *objPtr, *resPtr;
@@ -3337,7 +3337,7 @@ GetWideForIndex(
* representing an index. */
{
int numType;
- ClientData cd;
+ void *cd;
int code = TclGetNumberFromObj(NULL, objPtr, &cd, &numType);
if (code == TCL_OK) {
@@ -3456,7 +3456,7 @@ GetEndOffsetFromObj(
{
Tcl_ObjInternalRep *irPtr;
Tcl_WideInt offset = -1; /* Offset in the "end-offset" expression - 1 */
- ClientData cd;
+ void *cd;
while ((irPtr = TclFetchInternalRep(objPtr, &endOffsetType)) == NULL) {
Tcl_ObjInternalRep ir;
@@ -3466,7 +3466,8 @@ GetEndOffsetFromObj(
if (*bytes != 'e') {
int numType;
const char *opPtr;
- int len, t1 = 0, t2 = 0;
+ int t1 = 0, t2 = 0;
+ size_t len;
/* Value doesn't start with "e" */
@@ -3879,7 +3880,7 @@ GetThreadHash(
static void
FreeThreadHash(
- ClientData clientData)
+ void *clientData)
{
Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
@@ -3901,7 +3902,7 @@ FreeThreadHash(
static void
FreeProcessGlobalValue(
- ClientData clientData)
+ void *clientData)
{
ProcessGlobalValue *pgvPtr = (ProcessGlobalValue *)clientData;