diff options
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 458 |
1 files changed, 213 insertions, 245 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index f8f0004..a3f5d0b 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -127,8 +127,8 @@ Tcl_RegexpObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i, indices, match, about, offset, all, doinline, numMatchesSaved; - int cflags, eflags, stringLength, matchLength; + size_t offset, stringLength, matchLength, cflags, eflags; + int i, indices, match, about, all, doinline, numMatchesSaved; Tcl_RegExp regExpr; Tcl_Obj *objPtr, *startIndex = NULL, *resultPtr = NULL; Tcl_RegExpInfo info; @@ -146,7 +146,7 @@ Tcl_RegexpObjCmd( indices = 0; about = 0; cflags = TCL_REG_ADVANCED; - offset = 0; + offset = TCL_INDEX_START; all = 0; doinline = 0; @@ -191,11 +191,11 @@ Tcl_RegexpObjCmd( cflags |= TCL_REG_NLANCH; break; case REGEXP_START: { - int temp; + size_t temp; if (++i >= objc) { goto endOfForLoop; } - if (TclGetIntForIndexM(interp, objv[i], INT_MAX - 1, &temp) != TCL_OK) { + if (TclGetIntForIndexM(interp, objv[i], (size_t)WIDE_MAX - 1, &temp) != TCL_OK) { goto optionError; } if (startIndex) { @@ -261,8 +261,8 @@ Tcl_RegexpObjCmd( if (startIndex) { TclGetIntForIndexM(interp, startIndex, stringLength, &offset); Tcl_DecrRefCount(startIndex); - if (offset < 0) { - offset = 0; + if (offset == TCL_INDEX_NONE) { + offset = TCL_INDEX_START; } } @@ -306,9 +306,9 @@ Tcl_RegexpObjCmd( * start of the string unless the previous character is a newline. */ - if (offset == 0) { + if (offset == TCL_INDEX_START) { eflags = 0; - } else if (offset > stringLength) { + } else if (offset + 1 > stringLength + 1) { eflags = TCL_REG_NOTBOL; } else if (Tcl_GetUniChar(objPtr, offset-1) == '\n') { eflags = 0; @@ -357,14 +357,14 @@ Tcl_RegexpObjCmd( objc = info.nsubs + 1; if (all <= 1) { - TclNewObj(resultPtr); + resultPtr = Tcl_NewObj(); } } for (i = 0; i < objc; i++) { Tcl_Obj *newPtr; if (indices) { - int start, end; + size_t start, end; Tcl_Obj *objs[2]; /* @@ -372,7 +372,7 @@ Tcl_RegexpObjCmd( * area. (Scriptics Bug 4391/SF Bug #219232) */ - if (i <= info.nsubs && info.matches[i].start >= 0) { + if (i <= (int)info.nsubs && info.matches[i].start != TCL_INDEX_NONE) { start = offset + info.matches[i].start; end = offset + info.matches[i].end; @@ -381,25 +381,25 @@ Tcl_RegexpObjCmd( * match instead of the first character after the match. */ - if (end >= offset) { + if (end + 1 >= offset + 1) { end--; } } else { - start = -1; - end = -1; + start = TCL_INDEX_NONE; + end = TCL_INDEX_NONE; } - TclNewIntObj(objs[0], start); - TclNewIntObj(objs[1], end); + TclNewIndexObj(objs[0], start); + TclNewIndexObj(objs[1], end); newPtr = Tcl_NewListObj(2, objs); } else { - if (i <= info.nsubs) { + if (i <= (int)info.nsubs) { newPtr = Tcl_GetRange(objPtr, offset + info.matches[i].start, offset + info.matches[i].end - 1); } else { - TclNewObj(newPtr); + newPtr = Tcl_NewObj(); } } if (doinline) { @@ -444,7 +444,7 @@ Tcl_RegexpObjCmd( offset++; } all++; - if (offset >= stringLength) { + if (offset + 1 >= stringLength + 1) { break; } } @@ -487,8 +487,9 @@ Tcl_RegsubObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match, command, numParts; + int result, cflags, all, match, command, numParts; + size_t idx, wlen, wsublen = 0, offset, numMatches; + size_t start, end, subStart, subEnd; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; @@ -507,11 +508,11 @@ Tcl_RegsubObjCmd( cflags = TCL_REG_ADVANCED; all = 0; - offset = 0; + offset = TCL_INDEX_START; command = 0; resultPtr = NULL; - for (idx = 1; idx < objc; idx++) { + for (idx = 1; idx < (size_t)objc; idx++) { const char *name; int index; @@ -546,11 +547,11 @@ Tcl_RegsubObjCmd( cflags |= TCL_REG_NLANCH; break; case REGSUB_START: { - int temp; - if (++idx >= objc) { + size_t temp; + if (++idx >= (size_t)objc) { goto endOfForLoop; } - if (TclGetIntForIndexM(interp, objv[idx], INT_MAX - 1, &temp) != TCL_OK) { + if (TclGetIntForIndexM(interp, objv[idx], (size_t)WIDE_MAX - 1, &temp) != TCL_OK) { goto optionError; } if (startIndex) { @@ -567,7 +568,7 @@ Tcl_RegsubObjCmd( } endOfForLoop: - if (objc-idx < 3 || objc-idx > 4) { + if ((size_t)objc < idx + 3 || (size_t)objc > idx + 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-option ...? exp string subSpec ?varName?"); optionError: @@ -581,16 +582,16 @@ Tcl_RegsubObjCmd( objv += idx; if (startIndex) { - int stringLength = Tcl_GetCharLength(objv[1]); + size_t stringLength = Tcl_GetCharLength(objv[1]); TclGetIntForIndexM(interp, startIndex, stringLength, &offset); Tcl_DecrRefCount(startIndex); - if (offset < 0) { - offset = 0; + if (offset == TCL_INDEX_NONE) { + offset = TCL_INDEX_START; } } - if (all && (offset == 0) && (command == 0) + if (all && (offset == TCL_INDEX_START) && (command == 0) && (strpbrk(TclGetString(objv[2]), "&\\") == NULL) && (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) { /* @@ -598,13 +599,14 @@ Tcl_RegsubObjCmd( * slightly modified version of the one pair STR_MAP code. */ - int slen, nocase, wsrclc; - int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long); + size_t slen; + int nocase, wsrclc; + int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,size_t); Tcl_UniChar *p; numMatches = 0; nocase = (cflags & TCL_REG_NOCASE); - strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp; + strCmpFn = nocase ? TclUniCharNcasecmp : TclUniCharNcmp; wsrc = Tcl_GetUnicodeFromObj(objv[0], &slen); wstring = Tcl_GetUnicodeFromObj(objv[1], &wlen); @@ -622,8 +624,8 @@ Tcl_RegsubObjCmd( resultPtr = Tcl_NewUnicodeObj(wstring, 0); Tcl_IncrRefCount(resultPtr); for (; wstring < wend; wstring++) { - Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); - Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); + TclAppendUnicodeToObj(resultPtr, wsubspec, wsublen); + TclAppendUnicodeToObj(resultPtr, wstring, 1); numMatches++; } wlen = 0; @@ -633,21 +635,20 @@ Tcl_RegsubObjCmd( for (p = wfirstChar = wstring; wstring < wend; wstring++) { if ((*wstring == *wsrc || (nocase && Tcl_UniCharToLower(*wstring)==wsrclc)) && - (slen==1 || (strCmpFn(wstring, wsrc, - (unsigned long) slen) == 0))) { + (slen==1 || (strCmpFn(wstring, wsrc, slen) == 0))) { if (numMatches == 0) { resultPtr = Tcl_NewUnicodeObj(wstring, 0); Tcl_IncrRefCount(resultPtr); } if (p != wstring) { - Tcl_AppendUnicodeToObj(resultPtr, p, wstring - p); + TclAppendUnicodeToObj(resultPtr, p, wstring - p); p = wstring + slen; } else { p += slen; } wstring = p - 1; - Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); + TclAppendUnicodeToObj(resultPtr, wsubspec, wsublen); numMatches++; } } @@ -744,13 +745,13 @@ Tcl_RegsubObjCmd( if (numMatches == 0) { resultPtr = Tcl_NewUnicodeObj(wstring, 0); Tcl_IncrRefCount(resultPtr); - if (offset > 0) { + if (offset > TCL_INDEX_START) { /* * Copy the initial portion of the string in if an offset was * specified. */ - Tcl_AppendUnicodeToObj(resultPtr, wstring, offset); + TclAppendUnicodeToObj(resultPtr, wstring, offset); } } numMatches++; @@ -763,7 +764,7 @@ Tcl_RegsubObjCmd( Tcl_RegExpGetInfo(regExpr, &info); start = info.matches[0].start; end = info.matches[0].end; - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); + TclAppendUnicodeToObj(resultPtr, wstring + offset, start); /* * In command-prefix mode, the substitutions are added as quoted @@ -778,17 +779,17 @@ Tcl_RegsubObjCmd( Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); numArgs = numParts + info.nsubs + 1; - args = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj*) * numArgs); + args = (Tcl_Obj **)Tcl_Alloc(sizeof(Tcl_Obj*) * numArgs); memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); for (idx = 0 ; idx <= info.nsubs ; idx++) { subStart = info.matches[idx].start; subEnd = info.matches[idx].end; - if ((subStart >= 0) && (subEnd >= 0)) { + if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) { args[idx + numParts] = Tcl_NewUnicodeObj( wstring + offset + subStart, subEnd - subStart); } else { - TclNewObj(args[idx + numParts]); + args[idx + numParts] = Tcl_NewObj(); } Tcl_IncrRefCount(args[idx + numParts]); } @@ -808,7 +809,7 @@ Tcl_RegsubObjCmd( for (idx = 0 ; idx <= info.nsubs ; idx++) { TclDecrRefCount(args[idx + numParts]); } - ckfree(args); + Tcl_Free(args); if (result != TCL_OK) { if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( @@ -838,7 +839,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); + TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } @@ -867,7 +868,7 @@ Tcl_RegsubObjCmd( idx = ch - '0'; } else if ((ch == '\\') || (ch == '&')) { *wsrc = ch; - Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, + TclAppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar + 1); *wsrc = '\\'; wfirstChar = wsrc + 2; @@ -881,15 +882,15 @@ Tcl_RegsubObjCmd( } if (wfirstChar != wsrc) { - Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, + TclAppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); } if (idx <= info.nsubs) { subStart = info.matches[idx].start; subEnd = info.matches[idx].end; - if ((subStart >= 0) && (subEnd >= 0)) { - Tcl_AppendUnicodeToObj(resultPtr, + if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) { + TclAppendUnicodeToObj(resultPtr, wstring + offset + subStart, subEnd - subStart); } } @@ -901,7 +902,7 @@ Tcl_RegsubObjCmd( } if (wfirstChar != wsrc) { - Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); + TclAppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); } if (end == 0) { @@ -911,7 +912,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); + TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } else { @@ -923,7 +924,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); + TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } @@ -948,7 +949,7 @@ Tcl_RegsubObjCmd( resultPtr = objv[1]; Tcl_IncrRefCount(resultPtr); } else if (offset < wlen) { - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, wlen - offset); + TclAppendUnicodeToObj(resultPtr, wstring + offset, wlen - offset); } if (objc == 4) { if (Tcl_ObjSetVar2(interp, objv[3], NULL, resultPtr, @@ -1179,22 +1180,22 @@ Tcl_SplitObjCmd( const char *splitChars; const char *stringPtr; const char *end; - int splitCharLen, stringLen; + size_t splitCharLen, stringLen; Tcl_Obj *listPtr, *objPtr; if (objc == 2) { splitChars = " \n\t\r"; splitCharLen = 4; } else if (objc == 3) { - splitChars = TclGetStringFromObj(objv[2], &splitCharLen); + splitChars = Tcl_GetStringFromObj(objv[2], &splitCharLen); } else { Tcl_WrongNumArgs(interp, 1, objv, "string ?splitChars?"); return TCL_ERROR; } - stringPtr = TclGetStringFromObj(objv[1], &stringLen); + stringPtr = Tcl_GetStringFromObj(objv[1], &stringLen); end = stringPtr + stringLen; - TclNewObj(listPtr); + listPtr = Tcl_NewObj(); if (stringLen == 0) { /* @@ -1243,7 +1244,7 @@ Tcl_SplitObjCmd( * byte in length. */ - while (*stringPtr && (p=strchr(stringPtr,(int)*splitChars)) != NULL) { + while (*stringPtr && (p=strchr(stringPtr,*splitChars)) != NULL) { objPtr = Tcl_NewStringObj(stringPtr, p - stringPtr); Tcl_ListObjAppendElement(NULL, listPtr, objPtr); stringPtr = p + 1; @@ -1252,7 +1253,7 @@ Tcl_SplitObjCmd( Tcl_ListObjAppendElement(NULL, listPtr, objPtr); } else { const char *element, *p, *splitEnd; - int splitLen; + size_t splitLen; int splitChar; /* @@ -1307,7 +1308,7 @@ StringFirstCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int start = 0; + size_t start = TCL_INDEX_START; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1316,9 +1317,9 @@ StringFirstCmd( } if (objc == 4) { - int size = Tcl_GetCharLength(objv[2]); + size_t end = Tcl_GetCharLength(objv[2]) - 1; - if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &start)) { + if (TCL_OK != TclGetIntForIndexM(interp, objv[3], end, &start)) { return TCL_ERROR; } } @@ -1351,7 +1352,7 @@ StringLastCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int last = INT_MAX - 1; + size_t last = TCL_INDEX_END; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1360,9 +1361,9 @@ StringLastCmd( } if (objc == 4) { - int size = Tcl_GetCharLength(objv[2]); + size_t end = Tcl_GetCharLength(objv[2]) - 1; - if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &last)) { + if (TCL_OK != TclGetIntForIndexM(interp, objv[3], end, &last)) { return TCL_ERROR; } } @@ -1395,7 +1396,7 @@ StringIndexCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length, index; + size_t index, end; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "string charIndex"); @@ -1406,12 +1407,12 @@ StringIndexCmd( * Get the char length to calculate what 'end' means. */ - length = Tcl_GetCharLength(objv[1]); - if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { + end = Tcl_GetCharLength(objv[1]) - 1; + if (TclGetIntForIndexM(interp, objv[2], end, &index) != TCL_OK) { return TCL_ERROR; } - if ((index >= 0) && (index < length)) { + if ((index != TCL_INDEX_NONE) && (index + 1 <= end + 1)) { int ch = Tcl_GetUniChar(objv[1], index); if (ch == -1) { @@ -1430,11 +1431,11 @@ StringIndexCmd( } else { char buf[4] = ""; - length = Tcl_UniCharToUtf(ch, buf); - if ((ch >= 0xD800) && (length < 3)) { - length += Tcl_UniCharToUtf(-1, buf + length); + end = Tcl_UniCharToUtf(ch, buf); + if ((ch >= 0xD800) && (end < 3)) { + end += Tcl_UniCharToUtf(-1, buf + end); } - Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, length)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, end)); } } return TCL_OK; @@ -1465,8 +1466,8 @@ StringInsertCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - int length; /* String length */ - int index; /* Insert index */ + size_t length; /* String length */ + size_t index; /* Insert index */ Tcl_Obj *outObj; /* Output object */ if (objc != 4) { @@ -1479,8 +1480,8 @@ StringInsertCmd( return TCL_ERROR; } - if (index < 0) { - index = 0; + if (index == TCL_INDEX_NONE) { + index = TCL_INDEX_START; } if (index > length) { index = length; @@ -1524,7 +1525,9 @@ StringIsCmd( { const char *string1, *end, *stop; int (*chcomp)(int) = NULL; /* The UniChar comparison function. */ - int i, failat = 0, result = 1, strict = 0, index, length1, length2; + int i, result = 1, strict = 0, index, length3; + size_t failat = 0; + size_t length1, length2; Tcl_Obj *objPtr, *failVarObj = NULL; Tcl_WideInt w; @@ -1616,14 +1619,12 @@ StringIsCmd( if (strict) { result = 0; } else { - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); result = length1 == 0; } - } else if (index != STR_IS_BOOL) { - TclGetBooleanFromObj(NULL, objPtr, &i); - if ((index == STR_IS_TRUE) ^ i) { - result = 0; - } + } else if ((objPtr->internalRep.wideValue != 0) + ? (index == STR_IS_FALSE) : (index == STR_IS_TRUE)) { + result = 0; } break; case STR_IS_CONTROL: @@ -1643,10 +1644,11 @@ StringIsCmd( */ const char *elemStart, *nextElem; - int lenRemain, elemSize; + int lenRemain; + size_t elemSize; const char *p; - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); end = string1 + length1; failat = -1; for (p=string1, lenRemain=length1; lenRemain > 0; @@ -1686,7 +1688,7 @@ StringIsCmd( TclHasInternalRep(objPtr, &tclBignumType)) { break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1716,7 +1718,7 @@ StringIsCmd( TclHasInternalRep(objPtr, &tclBignumType)) { break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1758,7 +1760,7 @@ StringIsCmd( break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1811,7 +1813,7 @@ StringIsCmd( * well-formed lists. */ - if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) { + if (TCL_OK == TclListObjLength(NULL, objPtr, &length3)) { break; } @@ -1823,10 +1825,11 @@ StringIsCmd( */ const char *elemStart, *nextElem; - int lenRemain, elemSize; + size_t lenRemain; + size_t elemSize; const char *p; - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); end = string1 + length1; failat = -1; for (p=string1, lenRemain=length1; lenRemain > 0; @@ -1884,7 +1887,7 @@ StringIsCmd( } if (chcomp != NULL) { - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1910,7 +1913,7 @@ StringIsCmd( str_is_done: if ((result == 0) && (failVarObj != NULL)) { - TclNewIntObj(objPtr, failat); + TclNewIndexObj(objPtr, failat); if (Tcl_ObjSetVar2(interp, failVarObj, NULL, objPtr, TCL_LEAVE_ERR_MSG) == NULL) { return TCL_ERROR; } @@ -1958,11 +1961,11 @@ StringMapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length1, length2, mapElemc, index; + size_t length1, length2, mapElemc, index; int nocase = 0, mapWithDict = 0, copySource = 0; Tcl_Obj **mapElemv, *sourceObj, *resultPtr; Tcl_UniChar *ustring1, *ustring2, *p, *end; - int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned long); + int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, size_t); if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? charMap string"); @@ -1970,7 +1973,7 @@ StringMapCmd( } if (objc == 4) { - const char *string = TclGetStringFromObj(objv[1], &length2); + const char *string = Tcl_GetStringFromObj(objv[1], &length2); if ((length2 > 1) && strncmp(string, "-nocase", length2) == 0) { @@ -1999,8 +2002,8 @@ StringMapCmd( * sure. This shortens this code quite a bit. */ - Tcl_DictObjSize(interp, objv[objc-2], &mapElemc); - if (mapElemc == 0) { + Tcl_DictObjSize(interp, objv[objc-2], &i); + if (i == 0) { /* * Empty charMap, just return whatever string was given. */ @@ -2009,7 +2012,7 @@ StringMapCmd( return TCL_OK; } - mapElemc *= 2; + mapElemc = 2 * i; mapWithDict = 1; /* @@ -2020,15 +2023,17 @@ StringMapCmd( mapElemv = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc); Tcl_DictObjFirst(interp, objv[objc-2], &search, mapElemv+0, mapElemv+1, &done); - for (i=2 ; i<mapElemc ; i+=2) { - Tcl_DictObjNext(&search, mapElemv+i, mapElemv+i+1, &done); + for (index=2 ; index<mapElemc ; index+=2) { + Tcl_DictObjNext(&search, mapElemv+index, mapElemv+index+1, &done); } Tcl_DictObjDone(&search); } else { - if (TclListObjGetElements(interp, objv[objc-2], &mapElemc, + int i; + if (TclListObjGetElements(interp, objv[objc-2], &i, &mapElemv) != TCL_OK) { return TCL_ERROR; } + mapElemc = i; if (mapElemc == 0) { /* * empty charMap, just return whatever string was given. @@ -2070,7 +2075,7 @@ StringMapCmd( } end = ustring1 + length1; - strCmpFn = (nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp); + strCmpFn = (nocase ? TclUniCharNcasecmp : TclUniCharNcmp); /* * Force result to be Unicode @@ -2086,7 +2091,8 @@ StringMapCmd( * larger strings. */ - int mapLen, u2lc; + size_t mapLen; + int u2lc; Tcl_UniChar *mapString; ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2); @@ -2104,22 +2110,23 @@ StringMapCmd( if (((*ustring1 == *ustring2) || (nocase&&Tcl_UniCharToLower(*ustring1)==u2lc)) && (length2==1 || strCmpFn(ustring1, ustring2, - (unsigned long) length2) == 0)) { + length2) == 0)) { if (p != ustring1) { - Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p); + TclAppendUnicodeToObj(resultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; } ustring1 = p - 1; - Tcl_AppendUnicodeToObj(resultPtr, mapString, mapLen); + TclAppendUnicodeToObj(resultPtr, mapString, mapLen); } } } } else { Tcl_UniChar **mapStrings; - int *mapLens, *u2lc = NULL; + size_t *mapLens; + int *u2lc = 0; /* * Precompute pointers to the unicode string and length. This saves us @@ -2128,8 +2135,8 @@ StringMapCmd( * case. */ - mapStrings = (Tcl_UniChar **)TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *)); - mapLens = (int *)TclStackAlloc(interp, mapElemc * 2 * sizeof(int)); + mapStrings = (Tcl_UniChar **)TclStackAlloc(interp, mapElemc*sizeof(Tcl_UniChar *)*2); + mapLens = (size_t *)TclStackAlloc(interp, mapElemc * sizeof(size_t) * 2); if (nocase) { u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int)); } @@ -2151,14 +2158,14 @@ StringMapCmd( if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase && (Tcl_UniCharToLower(*ustring1) == u2lc[index/2]))) && /* Restrict max compare length. */ - (end-ustring1 >= length2) && ((length2 == 1) || + ((size_t)(end-ustring1) >= length2) && ((length2 == 1) || !strCmpFn(ustring2, ustring1, length2))) { if (p != ustring1) { /* * Put the skipped chars onto the result first. */ - Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p); + TclAppendUnicodeToObj(resultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; @@ -2174,7 +2181,7 @@ StringMapCmd( * Append the map value to the unicode string. */ - Tcl_AppendUnicodeToObj(resultPtr, + TclAppendUnicodeToObj(resultPtr, mapStrings[index+1], mapLens[index+1]); break; } @@ -2191,7 +2198,7 @@ StringMapCmd( * Put the rest of the unmapped chars onto result. */ - Tcl_AppendUnicodeToObj(resultPtr, p, ustring1 - p); + TclAppendUnicodeToObj(resultPtr, p, ustring1 - p); } Tcl_SetObjResult(interp, resultPtr); done: @@ -2237,8 +2244,8 @@ StringMatchCmd( } if (objc == 4) { - int length; - const char *string = TclGetStringFromObj(objv[1], &length); + size_t length; + const char *string = Tcl_GetStringFromObj(objv[1], &length); if ((length > 1) && strncmp(string, "-nocase", length) == 0) { @@ -2281,7 +2288,7 @@ StringRangeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length, first, last; + size_t first, last, end; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "string first last"); @@ -2293,20 +2300,20 @@ StringRangeCmd( * 'end' refers to the last character, not one past it. */ - length = Tcl_GetCharLength(objv[1]) - 1; + end = Tcl_GetCharLength(objv[1]) - 1; - if (TclGetIntForIndexM(interp, objv[2], length, &first) != TCL_OK || - TclGetIntForIndexM(interp, objv[3], length, &last) != TCL_OK) { + if (TclGetIntForIndexM(interp, objv[2], end, &first) != TCL_OK || + TclGetIntForIndexM(interp, objv[3], end, &last) != TCL_OK) { return TCL_ERROR; } - if (first < 0) { - first = 0; + if (first == TCL_INDEX_NONE) { + first = TCL_INDEX_START; } - if (last >= length) { - last = length; + if (last + 1 >= end + 1) { + last = end; } - if (last >= first) { + if (last + 1 >= first + 1) { Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last)); } return TCL_OK; @@ -2393,15 +2400,14 @@ StringRplcCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int first, last, length, end; + size_t first, last, end; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "string first last ?string?"); return TCL_ERROR; } - length = Tcl_GetCharLength(objv[1]); - end = length - 1; + end = Tcl_GetCharLength(objv[1]) - 1; if (TclGetIntForIndexM(interp, objv[2], end, &first) != TCL_OK || TclGetIntForIndexM(interp, objv[3], end, &last) != TCL_OK) { @@ -2414,10 +2420,9 @@ StringRplcCmd( * result is the original string. */ - if ((last < 0) || /* Range ends before start of string */ - (first > end) || /* Range begins after end of string */ - (last < first)) { /* Range begins after it starts */ - + if ((last == TCL_INDEX_NONE) || /* Range ends before start of string */ + (first + 1 > end + 1) || /* Range begins after end of string */ + (last + 1 < first + 1)) { /* Range begins after it starts */ /* * BUT!!! when (end < 0) -- an empty original string -- we can * have (first <= end < 0 <= last) and an empty string is permitted @@ -2428,10 +2433,10 @@ StringRplcCmd( } else { Tcl_Obj *resultPtr; - if (first < 0) { - first = 0; + if (first == TCL_INDEX_NONE) { + first = TCL_INDEX_START; } - if (last > end) { + if (last + 1 > end + 1) { last = end; } @@ -2504,7 +2509,7 @@ StringStartCmd( { int ch; const Tcl_UniChar *p, *string; - int cur, index, length; + size_t cur, index, length; Tcl_Obj *obj; if (objc != 3) { @@ -2516,15 +2521,15 @@ StringStartCmd( if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } - if (index >= length) { + if (index + 1 >= length + 1) { index = length - 1; } cur = 0; - if (index > 0) { + if (index + 1 > 1) { p = &string[index]; (void)TclUniCharToUCS4(p, &ch); - for (cur = index; cur >= 0; cur--) { + for (cur = index; cur != TCL_INDEX_NONE; cur--) { int delta = 0; const Tcl_UniChar *next; @@ -2543,7 +2548,7 @@ StringStartCmd( cur += 1; } } - TclNewIntObj(obj, cur); + TclNewIndexObj(obj, cur); Tcl_SetObjResult(interp, obj); return TCL_OK; } @@ -2574,7 +2579,7 @@ StringEndCmd( { int ch; const Tcl_UniChar *p, *end, *string; - int cur, index, length; + size_t cur, index, length; Tcl_Obj *obj; if (objc != 3) { @@ -2586,10 +2591,10 @@ StringEndCmd( if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } - if (index < 0) { - index = 0; + if (index == TCL_INDEX_NONE) { + index = TCL_INDEX_START; } - if (index < length) { + if (index + 1 <= length + 1) { p = &string[index]; end = string+length; for (cur = index; p < end; cur++) { @@ -2604,7 +2609,7 @@ StringEndCmd( } else { cur = length; } - TclNewIntObj(obj, cur); + TclNewIndexObj(obj, cur); Tcl_SetObjResult(interp, obj); return TCL_OK; } @@ -2641,7 +2646,8 @@ StringEqualCmd( */ const char *string2; - int length, i, match, nocase = 0, reqlength = -1; + int i, match, nocase = 0, reqlength = -1; + size_t length; if (objc < 3 || objc > 6) { str_cmp_args: @@ -2651,7 +2657,7 @@ StringEqualCmd( } for (i = 1; i < objc-2; i++) { - string2 = TclGetStringFromObj(objv[i], &length); + string2 = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && !strncmp(string2, "-nocase", length)) { nocase = 1; } else if ((length > 1) @@ -2736,7 +2742,8 @@ TclStringCmpOpts( int *nocase, int *reqlength) { - int i, length; + int i; + size_t length; const char *string; *reqlength = -1; @@ -2749,7 +2756,7 @@ TclStringCmpOpts( } for (i = 1; i < objc-2; i++) { - string = TclGetStringFromObj(objv[i], &length); + string = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && !strncmp(string, "-nocase", length)) { *nocase = 1; } else if ((length > 1) @@ -2820,45 +2827,6 @@ StringCatCmd( /* *---------------------------------------------------------------------- * - * StringBytesCmd -- - * - * This procedure is invoked to process the "string bytelength" Tcl - * command. See the user documentation for details on what it does. Note - * that this command only functions correctly on properly formed Tcl UTF - * strings. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ -#if TCL_MAJOR_VERSION < 9 && !defined(TCL_NO_DEPRECATED) -static int -StringBytesCmd( - TCL_UNUSED(ClientData), - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ -{ - int length; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "string"); - return TCL_ERROR; - } - - (void) TclGetStringFromObj(objv[1], &length); - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(length)); - return TCL_OK; -} -#endif - -/* - *---------------------------------------------------------------------- - * * StringLenCmd -- * * This procedure is invoked to process the "string length" Tcl command. @@ -2915,7 +2883,7 @@ StringLowerCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length1, length2; + size_t length1, length2; const char *string1; char *string2; @@ -2924,7 +2892,7 @@ StringLowerCmd( return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); if (objc == 2) { Tcl_Obj *resultPtr = Tcl_NewStringObj(string1, length1); @@ -2933,7 +2901,7 @@ StringLowerCmd( Tcl_SetObjLength(resultPtr, length1); Tcl_SetObjResult(interp, resultPtr); } else { - int first, last; + size_t first, last; const char *start, *end; Tcl_Obj *resultPtr; @@ -2941,7 +2909,7 @@ StringLowerCmd( if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } - if (first < 0) { + if (first == TCL_INDEX_NONE) { first = 0; } last = first; @@ -2951,15 +2919,15 @@ StringLowerCmd( return TCL_ERROR; } - if (last >= length1) { + if (last + 1 >= length1 + 1) { last = length1; } - if (last < first) { + if (last + 1 < first + 1) { Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); start = Tcl_UtfAtIndex(string1, first); end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); @@ -3000,7 +2968,7 @@ StringUpperCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length1, length2; + size_t length1, length2; const char *string1; char *string2; @@ -3009,7 +2977,7 @@ StringUpperCmd( return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); if (objc == 2) { Tcl_Obj *resultPtr = Tcl_NewStringObj(string1, length1); @@ -3018,7 +2986,7 @@ StringUpperCmd( Tcl_SetObjLength(resultPtr, length1); Tcl_SetObjResult(interp, resultPtr); } else { - int first, last; + size_t first, last; const char *start, *end; Tcl_Obj *resultPtr; @@ -3026,8 +2994,8 @@ StringUpperCmd( if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } - if (first < 0) { - first = 0; + if (first == TCL_INDEX_NONE) { + first = TCL_INDEX_START; } last = first; @@ -3036,15 +3004,15 @@ StringUpperCmd( return TCL_ERROR; } - if (last >= length1) { + if (last + 1 >= length1 + 1) { last = length1; } - if (last < first) { + if (last + 1 < first + 1) { Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); start = Tcl_UtfAtIndex(string1, first); end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); @@ -3085,7 +3053,7 @@ StringTitleCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length1, length2; + size_t length1, length2; const char *string1; char *string2; @@ -3094,7 +3062,7 @@ StringTitleCmd( return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); if (objc == 2) { Tcl_Obj *resultPtr = Tcl_NewStringObj(string1, length1); @@ -3103,7 +3071,7 @@ StringTitleCmd( Tcl_SetObjLength(resultPtr, length1); Tcl_SetObjResult(interp, resultPtr); } else { - int first, last; + size_t first, last; const char *start, *end; Tcl_Obj *resultPtr; @@ -3111,8 +3079,8 @@ StringTitleCmd( if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } - if (first < 0) { - first = 0; + if (first == TCL_INDEX_NONE) { + first = TCL_INDEX_START; } last = first; @@ -3121,15 +3089,15 @@ StringTitleCmd( return TCL_ERROR; } - if (last >= length1) { + if (last + 1 >= length1 + 1) { last = length1; } - if (last < first) { + if (last + 1 < first + 1) { Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); start = Tcl_UtfAtIndex(string1, first); end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); @@ -3171,10 +3139,10 @@ StringTrimCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; - int triml, trimr, length1, length2; + size_t triml, trimr, length1, length2; if (objc == 3) { - string2 = TclGetStringFromObj(objv[2], &length2); + string2 = Tcl_GetStringFromObj(objv[2], &length2); } else if (objc == 2) { string2 = tclDefaultTrimSet; length2 = strlen(tclDefaultTrimSet); @@ -3182,7 +3150,7 @@ StringTrimCmd( Tcl_WrongNumArgs(interp, 1, objv, "string ?chars?"); return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); triml = TclTrim(string1, length1, string2, length2, &trimr); @@ -3218,10 +3186,11 @@ StringTrimLCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; - int trim, length1, length2; + int trim; + size_t length1, length2; if (objc == 3) { - string2 = TclGetStringFromObj(objv[2], &length2); + string2 = Tcl_GetStringFromObj(objv[2], &length2); } else if (objc == 2) { string2 = tclDefaultTrimSet; length2 = strlen(tclDefaultTrimSet); @@ -3229,7 +3198,7 @@ StringTrimLCmd( Tcl_WrongNumArgs(interp, 1, objv, "string ?chars?"); return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); trim = TclTrimLeft(string1, length1, string2, length2); @@ -3264,10 +3233,11 @@ StringTrimRCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; - int trim, length1, length2; + int trim; + size_t length1, length2; if (objc == 3) { - string2 = TclGetStringFromObj(objv[2], &length2); + string2 = Tcl_GetStringFromObj(objv[2], &length2); } else if (objc == 2) { string2 = tclDefaultTrimSet; length2 = strlen(tclDefaultTrimSet); @@ -3275,7 +3245,7 @@ StringTrimRCmd( Tcl_WrongNumArgs(interp, 1, objv, "string ?chars?"); return TCL_ERROR; } - string1 = TclGetStringFromObj(objv[1], &length1); + string1 = Tcl_GetStringFromObj(objv[1], &length1); trim = TclTrimRight(string1, length1, string2, length2); @@ -3311,9 +3281,6 @@ TclInitStringCmd( Tcl_Interp *interp) /* Current interpreter. */ { static const EnsembleImplMap stringImplMap[] = { -#if TCL_MAJOR_VERSION < 9 && !defined(TCL_NO_DEPRECATED) - {"bytelength", StringBytesCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, -#endif {"cat", StringCatCmd, TclCompileStringCatCmd, NULL, NULL, 0}, {"compare", StringCmpCmd, TclCompileStringCmpCmd, NULL, NULL, 0}, {"equal", StringEqualCmd, TclCompileStringEqualCmd, NULL, NULL, 0}, @@ -3465,8 +3432,9 @@ TclNRSwitchObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i,j, index, mode, foundmode, splitObjs, numMatchesSaved; - int noCase, patternLength; + int i, index, mode, foundmode, splitObjs, numMatchesSaved; + int noCase; + size_t patternLength, j; const char *pattern; Tcl_Obj *stringObj, *indexVarObj, *matchVarObj; Tcl_Obj *const *savedObjv = objv; @@ -3689,7 +3657,7 @@ TclNRSwitchObjCmd( * See if the pattern matches the string. */ - pattern = TclGetStringFromObj(objv[i], &patternLength); + pattern = Tcl_GetStringFromObj(objv[i], &patternLength); if ((i == objc - 2) && (*pattern == 'd') && (strcmp(pattern, "default") == 0)) { @@ -3777,11 +3745,11 @@ TclNRSwitchObjCmd( if (indexVarObj != NULL) { Tcl_Obj *rangeObjAry[2]; - if (info.matches[j].end > 0) { - TclNewIntObj(rangeObjAry[0], info.matches[j].start); - TclNewIntObj(rangeObjAry[1], info.matches[j].end-1); + if (info.matches[j].end + 1 > 1) { + TclNewIndexObj(rangeObjAry[0], info.matches[j].start); + TclNewIndexObj(rangeObjAry[1], info.matches[j].end-1); } else { - TclNewIntObj(rangeObjAry[1], TCL_INDEX_NONE); + TclNewIndexObj(rangeObjAry[1], TCL_INDEX_NONE); rangeObjAry[0] = rangeObjAry[1]; } @@ -3874,7 +3842,7 @@ TclNRSwitchObjCmd( if (ctxPtr->type == TCL_LOCATION_SOURCE && ctxPtr->line[bidx] >= 0) { int bline = ctxPtr->line[bidx]; - ctxPtr->line = (int *)ckalloc(objc * sizeof(int)); + ctxPtr->line = (int *)Tcl_Alloc(objc * sizeof(int)); ctxPtr->nline = objc; TclListLines(blist, bline, objc, ctxPtr->line, objv); } else { @@ -3888,7 +3856,7 @@ TclNRSwitchObjCmd( int k; - ctxPtr->line = (int *)ckalloc(objc * sizeof(int)); + ctxPtr->line = (int *)Tcl_Alloc(objc * sizeof(int)); ctxPtr->nline = objc; for (k=0; k < objc; k++) { ctxPtr->line[k] = -1; @@ -3897,7 +3865,7 @@ TclNRSwitchObjCmd( } for (j = i + 1; ; j += 2) { - if (j >= objc) { + if (j >= (size_t)objc) { /* * This shouldn't happen since we've checked that the last body is * not a continuation... @@ -3931,14 +3899,14 @@ SwitchPostProc( CmdFrame *ctxPtr = (CmdFrame *)data[1]; int pc = PTR2INT(data[2]); const char *pattern = (const char *)data[3]; - int patternLength = strlen(pattern); + size_t patternLength = strlen(pattern); /* * Clean up TIP 280 context information */ if (splitObjs) { - ckfree(ctxPtr->line); + Tcl_Free(ctxPtr->line); if (pc && (ctxPtr->type == TCL_LOCATION_SOURCE)) { /* * Death of SrcInfo reference. @@ -3953,12 +3921,12 @@ SwitchPostProc( */ if (result == TCL_ERROR) { - int limit = 50; + unsigned limit = 50; int overflow = (patternLength > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (\"%.*s%s\" arm line %d)", - (overflow ? limit : patternLength), pattern, + (overflow ? limit : (unsigned)patternLength), pattern, (overflow ? "..." : ""), Tcl_GetErrorLine(interp))); } TclStackFree(interp, ctxPtr); @@ -4726,7 +4694,7 @@ TclNRTryObjCmd( return TCL_ERROR; } bodyObj = objv[1]; - TclNewObj(handlersObj); + handlersObj = Tcl_NewObj(); bodyShared = 0; haveHandlers = 0; for (i=2 ; i<objc ; i++) { @@ -4792,7 +4760,7 @@ TclNRTryObjCmd( if (Tcl_ListObjLength(NULL, objv[i+1], &dummy) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad prefix '%s': must be a list", - Tcl_GetString(objv[i+1]))); + TclGetString(objv[i+1]))); Tcl_DecrRefCount(handlersObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP", "EXNFORMAT", NULL); @@ -5332,7 +5300,7 @@ TclListLines( Tcl_Obj *const *elems) /* The list elems as Tcl_Obj*, in need of * derived continuation data */ { - const char *listStr = Tcl_GetString(listObj); + const char *listStr = TclGetString(listObj); const char *listHead = listStr; int i, length = strlen(listStr); const char *element = NULL, *next = NULL; |