diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-01-11 10:03:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-01-11 10:03:18 (GMT) |
commit | 7475433fc2d4d5df9d885664d8c7f430d61e7c84 (patch) | |
tree | f0ce649ff6c20ba0f4150fb0d9d10fdd8def247c | |
parent | 8229cd730444707ecef238b9678a5c8d779554f0 (diff) | |
parent | 089b9970444fbf3410572b30650c80fc75bdda82 (diff) | |
download | tcl-7475433fc2d4d5df9d885664d8c7f430d61e7c84.zip tcl-7475433fc2d4d5df9d885664d8c7f430d61e7c84.tar.gz tcl-7475433fc2d4d5df9d885664d8c7f430d61e7c84.tar.bz2 |
Merge 8.7, resolve conflicts
67 files changed, 617 insertions, 494 deletions
diff --git a/doc/StringObj.3 b/doc/StringObj.3 index 33c5c79..d2d66f5 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -116,7 +116,7 @@ returned as a new value. Points to a value to manipulate. .AP Tcl_Obj *appendObjPtr in The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR. -.AP int *lengthPtr out +.AP size_t | int *lengthPtr out If non-NULL, the location where \fBTcl_GetStringFromObj\fR will store the length of a value's string representation. .AP "const char" *string in diff --git a/generic/tcl.decls b/generic/tcl.decls index 3375da5..db6e0a6 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -145,7 +145,7 @@ declare 32 { int *boolPtr) } declare 33 { - unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr) + unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr) } declare 34 { int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr) @@ -172,7 +172,7 @@ declare 40 { const Tcl_ObjType *Tcl_GetObjType(const char *typeName) } declare 41 { - char *Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr) + char *TclGetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr) } declare 42 { void Tcl_InvalidateStringRep(Tcl_Obj *objPtr) @@ -1601,7 +1601,7 @@ declare 433 { # introduced in 8.4a3 declare 434 { - Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr) + Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr) } # TIP#15 (math function introspection) dkf @@ -2465,6 +2465,17 @@ declare 648 { size_t length, Tcl_DString *dsPtr) } +# TIP #481 +declare 651 { + char *Tcl_GetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr) +} +declare 652 { + Tcl_UniChar *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr) +} +declare 653 { + unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lengthPtr) +} + # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## diff --git a/generic/tcl.h b/generic/tcl.h index a0d8edc..831b558 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -258,10 +258,6 @@ typedef void *ClientData; * * The following invariant should hold for any long value 'longVal': * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) - * - * Note on converting between Tcl_WideInt and strings. This implementation (in - * tclObj.c) depends on the function - * sprintf(...,"%" TCL_LL_MODIFIER "d",...). */ #if !defined(TCL_WIDE_INT_TYPE) && !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__GNUC__) @@ -929,7 +925,7 @@ typedef struct Tcl_DString { #define TCL_LINK_CHARS 15 #define TCL_LINK_BINARY 16 #define TCL_LINK_READ_ONLY 0x80 - + /* *---------------------------------------------------------------------------- * Forward declarations of Tcl_HashTable and related types. diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 0418bb6..5a961bc 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -887,7 +887,7 @@ CompileAssembleObj( * Set up the compilation environment, and assemble the code. */ - source = TclGetStringFromObj(objPtr, &sourceLen); + source = Tcl_GetStringFromObj(objPtr, &sourceLen); TclInitCompileEnv(interp, &compEnv, source, sourceLen, NULL, 0); status = TclAssembleCode(&compEnv, source, sourceLen, TCL_EVAL_DIRECT); if (status != TCL_OK) { @@ -1311,7 +1311,7 @@ AssembleOneLine( if (GetNextOperand(assemEnvPtr, &tokenPtr, &operand1Obj) != TCL_OK) { goto cleanup; } - operand1 = TclGetStringFromObj(operand1Obj, &operand1Len); + operand1 = Tcl_GetStringFromObj(operand1Obj, &operand1Len); litIndex = TclRegisterLiteral(envPtr, operand1, operand1Len, 0); BBEmitInst1or4(assemEnvPtr, tblIdx, litIndex, 0); break; @@ -1478,7 +1478,7 @@ AssembleOneLine( &operand1Obj) != TCL_OK) { goto cleanup; } else { - operand1 = TclGetStringFromObj(operand1Obj, &operand1Len); + operand1 = Tcl_GetStringFromObj(operand1Obj, &operand1Len); litIndex = TclRegisterLiteral(envPtr, operand1, operand1Len, 0); /* @@ -2315,7 +2315,7 @@ FindLocalVar( if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) { return -1; } - varNameStr = TclGetStringFromObj(varNameObj, &varNameLen); + varNameStr = Tcl_GetStringFromObj(varNameObj, &varNameLen); if (CheckNamespaceQualifiers(interp, varNameStr, varNameLen)) { Tcl_DecrRefCount(varNameObj); return -1; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index cc45053..5e6fc98 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3955,7 +3955,7 @@ Tcl_Canceled( */ if (iPtr->asyncCancelMsg != NULL) { - message = TclGetStringFromObj(iPtr->asyncCancelMsg, &length); + message = Tcl_GetStringFromObj(iPtr->asyncCancelMsg, &length); } else { length = 0; } @@ -4054,7 +4054,7 @@ Tcl_CancelEval( */ if (resultObjPtr != NULL) { - result = TclGetStringFromObj(resultObjPtr, &cancelInfo->length); + result = Tcl_GetStringFromObj(resultObjPtr, &cancelInfo->length); cancelInfo->result = (char *)Tcl_Realloc(cancelInfo->result,cancelInfo->length); memcpy(cancelInfo->result, result, cancelInfo->length); TclDecrRefCount(resultObjPtr); /* Discard their result object. */ @@ -4553,7 +4553,7 @@ TEOV_Error( */ listPtr = Tcl_NewListObj(objc, objv); - cmdString = TclGetStringFromObj(listPtr, &cmdLen); + cmdString = Tcl_GetStringFromObj(listPtr, &cmdLen); Tcl_LogCommandInfo(interp, cmdString, cmdString, cmdLen); Tcl_DecrRefCount(listPtr); } @@ -4699,7 +4699,7 @@ TEOV_RunEnterTraces( Command *cmdPtr = *cmdPtrPtr; size_t length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch; int traceCode = TCL_OK; - const char *command = TclGetStringFromObj(commandPtr, &length); + const char *command = Tcl_GetStringFromObj(commandPtr, &length); /* * Call trace functions. @@ -4751,7 +4751,7 @@ TEOV_RunLeaveTraces( Command *cmdPtr = (Command *)data[2]; Tcl_Obj **objv = (Tcl_Obj **)data[3]; size_t length; - const char *command = TclGetStringFromObj(commandPtr, &length); + const char *command = Tcl_GetStringFromObj(commandPtr, &length); if (!(cmdPtr->flags & CMD_DYING)) { if (cmdPtr->flags & CMD_HAS_EXEC_TRACES) { @@ -5993,7 +5993,7 @@ TclNREvalObjEx( Tcl_IncrRefCount(objPtr); - script = TclGetStringFromObj(objPtr, &numSrcBytes); + script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); result = Tcl_EvalEx(interp, script, numSrcBytes, flags); TclDecrRefCount(objPtr); @@ -6024,7 +6024,7 @@ TEOEx_ByteCodeCallback( ProcessUnexpectedResult(interp, result); result = TCL_ERROR; - script = TclGetStringFromObj(objPtr, &numSrcBytes); + script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); Tcl_LogCommandInfo(interp, script, script, numSrcBytes); } @@ -6555,7 +6555,7 @@ Tcl_AppendObjToErrorInfo( Tcl_Obj *objPtr) /* Message to record. */ { size_t length; - const char *message = TclGetStringFromObj(objPtr, &length); + const char *message = Tcl_GetStringFromObj(objPtr, &length); Interp *iPtr = (Interp *) interp; Tcl_IncrRefCount(objPtr); @@ -7139,7 +7139,7 @@ ExprAbsFunc( } else if (l == 0) { if (TclHasStringRep(objv[1])) { size_t numBytes; - const char *bytes = TclGetStringFromObj(objv[1], &numBytes); + const char *bytes = Tcl_GetStringFromObj(objv[1], &numBytes); while (numBytes) { if (*bytes == '-') { diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 110ba74..f7cb02d 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -491,7 +491,7 @@ TclGetBytesFromObj( /* *---------------------------------------------------------------------- * - * Tcl_GetByteArrayFromObj -- + * Tcl_GetByteArrayFromObj/TclGetByteArrayFromObj -- * * Attempt to get the array of bytes from the Tcl object. If the object * is not already a ByteArray object, an attempt will be made to convert @@ -506,8 +506,9 @@ TclGetBytesFromObj( *---------------------------------------------------------------------- */ +#undef Tcl_GetByteArrayFromObj unsigned char * -Tcl_GetByteArrayFromObj( +TclGetByteArrayFromObj( Tcl_Obj *objPtr, /* The ByteArray object. */ int *lengthPtr) /* If non-NULL, filled with length of the * array of bytes in the ByteArray object. */ @@ -531,9 +532,7 @@ Tcl_GetByteArrayFromObj( if (lengthPtr) { if (numBytes > INT_MAX) { /* Caller asked for an int length, but true length is outside - * the int range. This case will be developed out of existence - * in Tcl 9. As interim measure, fail. */ - + * the int range. */ *lengthPtr = 0; return NULL; } else { @@ -542,6 +541,32 @@ Tcl_GetByteArrayFromObj( } return bytes; } + +unsigned char * +Tcl_GetByteArrayFromObj( + Tcl_Obj *objPtr, /* The ByteArray object. */ + size_t *lengthPtr) /* If non-NULL, filled with length of the + * array of bytes in the ByteArray object. */ +{ + size_t numBytes = 0; + unsigned char *bytes = TclGetBytesFromObj(NULL, objPtr, &numBytes); + + if (bytes == NULL) { + ByteArray *baPtr; + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); + + assert(irPtr != NULL); + + baPtr = GET_BYTEARRAY(irPtr); + bytes = baPtr->bytes; + numBytes = baPtr->used; + } + + if (lengthPtr) { + *lengthPtr = numBytes; + } + return bytes; +} /* *---------------------------------------------------------------------- @@ -637,7 +662,7 @@ SetByteArrayFromAny( return TCL_OK; } - src = TclGetStringFromObj(objPtr, &length); + src = Tcl_GetStringFromObj(objPtr, &length); bad = length; srcEnd = src + length; @@ -1029,7 +1054,7 @@ BinaryFormatCmd( goto badIndex; } if (count == BINARY_ALL) { - (void)TclGetByteArrayFromObj(objv[arg], &count); + (void)Tcl_GetByteArrayFromObj(objv[arg], &count); } else if (count == BINARY_NOCOUNT) { count = 1; } @@ -1193,7 +1218,7 @@ BinaryFormatCmd( char pad = (char) (cmd == 'a' ? '\0' : ' '); unsigned char *bytes; - bytes = TclGetByteArrayFromObj(objv[arg], &length); + bytes = Tcl_GetByteArrayFromObj(objv[arg], &length); arg++; if (count == BINARY_ALL) { count = length; @@ -1213,7 +1238,7 @@ BinaryFormatCmd( case 'B': { unsigned char *last; - str = TclGetStringFromObj(objv[arg], &length); + str = Tcl_GetStringFromObj(objv[arg], &length); arg++; if (count == BINARY_ALL) { count = length; @@ -1275,7 +1300,7 @@ BinaryFormatCmd( unsigned char *last; int c; - str = TclGetStringFromObj(objv[arg], &length); + str = Tcl_GetStringFromObj(objv[arg], &length); arg++; if (count == BINARY_ALL) { count = length; @@ -1506,7 +1531,7 @@ BinaryScanCmd( } numberCachePtr = &numberCacheHash; Tcl_InitHashTable(numberCachePtr, TCL_ONE_WORD_KEYS); - buffer = TclGetByteArrayFromObj(objv[1], &length); + buffer = Tcl_GetByteArrayFromObj(objv[1], &length); format = TclGetString(objv[2]); arg = 3; offset = 0; @@ -2568,7 +2593,7 @@ BinaryEncodeHex( } TclNewObj(resultObj); - data = TclGetByteArrayFromObj(objv[1], &count); + data = Tcl_GetByteArrayFromObj(objv[1], &count); cursor = Tcl_SetByteArrayLength(resultObj, count * 2); for (offset = 0; offset < count; ++offset) { *cursor++ = HexDigits[(data[offset] >> 4) & 0x0F]; @@ -2630,7 +2655,7 @@ BinaryDecodeHex( data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; - data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); + data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count); } datastart = data; dataend = data + count; @@ -2764,7 +2789,7 @@ BinaryEncode64( objv[i + 1], &wrapcharlen); if (wrapchar == NULL) { purewrap = 0; - wrapchar = TclGetStringFromObj(objv[i + 1], &wrapcharlen); + wrapchar = Tcl_GetStringFromObj(objv[i + 1], &wrapcharlen); } break; } @@ -2774,7 +2799,7 @@ BinaryEncode64( } TclNewObj(resultObj); - data = TclGetByteArrayFromObj(objv[objc - 1], &count); + data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count); if (count > 0) { unsigned char *cursor = NULL; @@ -2885,7 +2910,7 @@ BinaryEncodeUu( lineLength = ((lineLength - 1) & -4) + 1; /* 5, 9, 13 ... */ break; case OPT_WRAPCHAR: - wrapchar = (const unsigned char *) TclGetStringFromObj( + wrapchar = (const unsigned char *) Tcl_GetStringFromObj( objv[i + 1], &wrapcharlen); { const unsigned char *p = wrapchar; @@ -2927,7 +2952,7 @@ BinaryEncodeUu( TclNewObj(resultObj); offset = 0; - data = TclGetByteArrayFromObj(objv[objc - 1], &count); + data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count); rawLength = (lineLength - 1) * 3 / 4; start = cursor = Tcl_SetByteArrayLength(resultObj, (lineLength + wrapcharlen) * @@ -3027,7 +3052,7 @@ BinaryDecodeUu( data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; - data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); + data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count); } datastart = data; dataend = data + count; @@ -3202,7 +3227,7 @@ BinaryDecode64( data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; - data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); + data = (unsigned char *) Tcl_GetStringFromObj(objv[objc - 1], &count); } datastart = data; dataend = data + count; diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index c667f6b..f02bc33 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -431,7 +431,7 @@ EncodingConvertfromObjCmd( /* * Convert the string into a byte array in 'ds' */ - bytesPtr = (char *) TclGetByteArrayFromObj(data, &length); + bytesPtr = (char *) Tcl_GetByteArrayFromObj(data, &length); Tcl_ExternalToUtfDString(encoding, bytesPtr, length, &ds); /* @@ -496,7 +496,7 @@ EncodingConverttoObjCmd( * Convert the string to a byte array in 'ds' */ - stringPtr = TclGetStringFromObj(data, &length); + stringPtr = Tcl_GetStringFromObj(data, &length); Tcl_UtfToExternalDString(encoding, stringPtr, length, &ds); Tcl_SetObjResult(interp, Tcl_NewByteArrayObj((unsigned char*) Tcl_DStringValue(&ds), diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 736ba62..75eb441 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -545,7 +545,7 @@ InfoBodyCmd( * the object do not invalidate the internal rep. */ - bytes = TclGetStringFromObj(procPtr->bodyPtr, &numBytes); + bytes = Tcl_GetStringFromObj(procPtr->bodyPtr, &numBytes); Tcl_SetObjResult(interp, Tcl_NewStringObj(bytes, numBytes)); return TCL_OK; } @@ -2212,7 +2212,7 @@ Tcl_JoinObjCmd( joinObjPtr = (objc == 2) ? Tcl_NewStringObj(" ", 1) : objv[2]; Tcl_IncrRefCount(joinObjPtr); - (void) TclGetStringFromObj(joinObjPtr, &length); + (void) Tcl_GetStringFromObj(joinObjPtr, &length); if (length == 0) { resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0); } else { @@ -3539,7 +3539,7 @@ Tcl_LsearchObjCmd( switch ((enum datatypes) dataType) { case ASCII: case DICTIONARY: - patternBytes = TclGetStringFromObj(patObj, &length); + patternBytes = Tcl_GetStringFromObj(patObj, &length); break; case INTEGER: result = TclGetWideIntFromObj(interp, patObj, &patWide); @@ -3569,7 +3569,7 @@ Tcl_LsearchObjCmd( break; } } else { - patternBytes = TclGetStringFromObj(patObj, &length); + patternBytes = Tcl_GetStringFromObj(patObj, &length); } /* @@ -3713,7 +3713,7 @@ Tcl_LsearchObjCmd( case EXACT: switch ((enum datatypes) dataType) { case ASCII: - bytes = TclGetStringFromObj(itemPtr, &elemLen); + bytes = Tcl_GetStringFromObj(itemPtr, &elemLen); if (length == elemLen) { /* * This split allows for more optimal compilation of diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 9b47087..848b1dc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -608,9 +608,9 @@ Tcl_RegsubObjCmd( nocase = (cflags & TCL_REG_NOCASE); strCmpFn = nocase ? TclUniCharNcasecmp : TclUniCharNcmp; - wsrc = TclGetUnicodeFromObj(objv[0], &slen); - wstring = TclGetUnicodeFromObj(objv[1], &wlen); - wsubspec = TclGetUnicodeFromObj(objv[2], &wsublen); + wsrc = Tcl_GetUnicodeFromObj(objv[0], &slen); + wstring = Tcl_GetUnicodeFromObj(objv[1], &wlen); + wsubspec = Tcl_GetUnicodeFromObj(objv[2], &wsublen); wend = wstring + wlen - (slen ? slen - 1 : 0); result = TCL_OK; @@ -700,14 +700,14 @@ Tcl_RegsubObjCmd( } else { objPtr = objv[1]; } - wstring = TclGetUnicodeFromObj(objPtr, &wlen); + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); if (objv[2] == objv[0]) { subPtr = Tcl_DuplicateObj(objv[2]); } else { subPtr = objv[2]; } if (!command) { - wsubspec = TclGetUnicodeFromObj(subPtr, &wsublen); + wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); } result = TCL_OK; @@ -827,7 +827,7 @@ Tcl_RegsubObjCmd( * the user code. */ - wstring = TclGetUnicodeFromObj(objPtr, &wlen); + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); offset += end; if (end == 0 || start == end) { @@ -1187,13 +1187,13 @@ Tcl_SplitObjCmd( 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; listPtr = Tcl_NewObj(); @@ -1619,7 +1619,7 @@ StringIsCmd( if (strict) { result = 0; } else { - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); result = length1 == 0; } } else if ((objPtr->internalRep.wideValue != 0) @@ -1648,7 +1648,7 @@ StringIsCmd( 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; @@ -1688,7 +1688,7 @@ StringIsCmd( TclHasIntRep(objPtr, &tclBignumType)) { break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1718,7 +1718,7 @@ StringIsCmd( TclHasIntRep(objPtr, &tclBignumType)) { break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1760,7 +1760,7 @@ StringIsCmd( break; } - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1829,7 +1829,7 @@ StringIsCmd( 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 +1884,7 @@ StringIsCmd( } if (chcomp != NULL) { - string1 = TclGetStringFromObj(objPtr, &length1); + string1 = Tcl_GetStringFromObj(objPtr, &length1); if (length1 == 0) { if (strict) { result = 0; @@ -1970,7 +1970,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) { @@ -2062,7 +2062,7 @@ StringMapCmd( } else { sourceObj = objv[objc-1]; } - ustring1 = TclGetUnicodeFromObj(sourceObj, &length1); + ustring1 = Tcl_GetUnicodeFromObj(sourceObj, &length1); if (length1 == 0) { /* * Empty input string, just stop now. @@ -2092,7 +2092,7 @@ StringMapCmd( int u2lc; Tcl_UniChar *mapString; - ustring2 = TclGetUnicodeFromObj(mapElemv[0], &length2); + ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2); p = ustring1; if ((length2 > length1) || (length2 == 0)) { /* @@ -2101,7 +2101,7 @@ StringMapCmd( ustring1 = end; } else { - mapString = TclGetUnicodeFromObj(mapElemv[1], &mapLen); + mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen); u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0); for (; ustring1 < end; ustring1++) { if (((*ustring1 == *ustring2) || @@ -2138,7 +2138,7 @@ StringMapCmd( u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { - mapStrings[index] = TclGetUnicodeFromObj(mapElemv[index], + mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], mapLens+index); if (nocase && ((index % 2) == 0)) { u2lc[index/2] = Tcl_UniCharToLower(*mapStrings[index]); @@ -2242,7 +2242,7 @@ StringMatchCmd( if (objc == 4) { size_t length; - const char *string = TclGetStringFromObj(objv[1], &length); + const char *string = Tcl_GetStringFromObj(objv[1], &length); if ((length > 1) && strncmp(string, "-nocase", length) == 0) { @@ -2514,7 +2514,7 @@ StringStartCmd( return TCL_ERROR; } - string = TclGetUnicodeFromObj(objv[1], &length); + string = Tcl_GetUnicodeFromObj(objv[1], &length); if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } @@ -2584,7 +2584,7 @@ StringEndCmd( return TCL_ERROR; } - string = TclGetUnicodeFromObj(objv[1], &length); + string = Tcl_GetUnicodeFromObj(objv[1], &length); if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) { return TCL_ERROR; } @@ -2654,7 +2654,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) @@ -2753,7 +2753,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) @@ -2854,7 +2854,7 @@ StringBytesCmd( return TCL_ERROR; } - (void) TclGetStringFromObj(objv[1], &length); + (void) Tcl_GetStringFromObj(objv[1], &length); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(length)); return TCL_OK; } @@ -2927,7 +2927,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); @@ -2962,7 +2962,7 @@ StringLowerCmd( 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); @@ -3012,7 +3012,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); @@ -3047,7 +3047,7 @@ StringUpperCmd( 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); @@ -3097,7 +3097,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); @@ -3132,7 +3132,7 @@ StringTitleCmd( 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); @@ -3177,7 +3177,7 @@ StringTrimCmd( 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); @@ -3185,7 +3185,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); @@ -3225,7 +3225,7 @@ StringTrimLCmd( 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); @@ -3233,7 +3233,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); @@ -3272,7 +3272,7 @@ StringTrimRCmd( 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); @@ -3280,7 +3280,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); @@ -3693,7 +3693,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)) { diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 5d788b8..c382c52 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -896,7 +896,7 @@ TclCompileConcatCmd( Tcl_ListObjGetElements(NULL, listObj, &len, &objs); objPtr = Tcl_ConcatObj(len, objs); Tcl_DecrRefCount(listObj); - bytes = TclGetStringFromObj(objPtr, &slen); + bytes = Tcl_GetStringFromObj(objPtr, &slen); PushLiteral(envPtr, bytes, slen); Tcl_DecrRefCount(objPtr); return TCL_OK; @@ -1333,7 +1333,7 @@ TclCompileDictCreateCmd( * We did! Excellent. The "verifyDict" is to do type forcing. */ - bytes = TclGetStringFromObj(dictObj, &len); + bytes = Tcl_GetStringFromObj(dictObj, &len); PushLiteral(envPtr, bytes, len); TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_DICT_VERIFY, envPtr); @@ -2773,7 +2773,7 @@ CompileEachloopCmd( Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); - bytes = TclGetStringFromObj(varNameObj, &length); + bytes = Tcl_GetStringFromObj(varNameObj, &length); varIndex = LocalScalar(bytes, length, envPtr); if (varIndex < 0) { code = TCL_ERROR; @@ -3210,7 +3210,7 @@ TclCompileFormatCmd( * literal. Job done. */ - bytes = TclGetStringFromObj(tmpObj, &len); + bytes = Tcl_GetStringFromObj(tmpObj, &len); PushLiteral(envPtr, bytes, len); Tcl_DecrRefCount(tmpObj); return TCL_OK; @@ -3281,7 +3281,7 @@ TclCompileFormatCmd( if (*++bytes == '%') { Tcl_AppendToObj(tmpObj, "%", 1); } else { - const char *b = TclGetStringFromObj(tmpObj, &len); + const char *b = Tcl_GetStringFromObj(tmpObj, &len); /* * If there is a non-empty literal from the format string, @@ -3315,7 +3315,7 @@ TclCompileFormatCmd( */ Tcl_AppendToObj(tmpObj, start, bytes - start); - bytes = TclGetStringFromObj(tmpObj, &len); + bytes = Tcl_GetStringFromObj(tmpObj, &len); if (len > 0) { PushLiteral(envPtr, bytes, len); i++; diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 521ec27..ecd087e 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2304,7 +2304,7 @@ TclCompileRegsubCmd( * replacement "simple"? */ - bytes = TclGetStringFromObj(patternObj, &len); + bytes = Tcl_GetStringFromObj(patternObj, &len); if (TclReToGlob(NULL, bytes, len, &pattern, &exact, &quantified) != TCL_OK || exact || quantified) { goto done; @@ -2352,7 +2352,7 @@ TclCompileRegsubCmd( result = TCL_OK; bytes = Tcl_DStringValue(&pattern) + 1; PushLiteral(envPtr, bytes, len); - bytes = TclGetStringFromObj(replacementObj, &len); + bytes = Tcl_GetStringFromObj(replacementObj, &len); PushLiteral(envPtr, bytes, len); CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords - 2); TclEmitOpcode( INST_STR_MAP, envPtr); @@ -2610,7 +2610,7 @@ TclCompileSyntaxError( { Tcl_Obj *msg = Tcl_GetObjResult(interp); size_t numBytes; - const char *bytes = TclGetStringFromObj(msg, &numBytes); + const char *bytes = Tcl_GetStringFromObj(msg, &numBytes); TclErrorStackResetIf(interp, bytes, numBytes); TclEmitPush(TclRegisterLiteral(envPtr, bytes, numBytes, 0), envPtr); @@ -2868,7 +2868,7 @@ IndexTailVarIfKnown( Tcl_SetStringObj(tailPtr, lastTokenPtr->start, lastTokenPtr->size); } - tailName = TclGetStringFromObj(tailPtr, &len); + tailName = Tcl_GetStringFromObj(tailPtr, &len); if (len) { if (*(tailName + len - 1) == ')') { diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index a7d1334..5b752b3 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -253,7 +253,7 @@ TclCompileStringCatCmd( Tcl_DecrRefCount(obj); if (folded) { size_t len; - const char *bytes = TclGetStringFromObj(folded, &len); + const char *bytes = Tcl_GetStringFromObj(folded, &len); PushLiteral(envPtr, bytes, len); Tcl_DecrRefCount(folded); @@ -271,7 +271,7 @@ TclCompileStringCatCmd( } if (folded) { size_t len; - const char *bytes = TclGetStringFromObj(folded, &len); + const char *bytes = Tcl_GetStringFromObj(folded, &len); PushLiteral(envPtr, bytes, len); Tcl_DecrRefCount(folded); @@ -951,12 +951,12 @@ TclCompileStringMapCmd( * correct semantics for mapping. */ - bytes = TclGetStringFromObj(objv[0], &slen); + bytes = Tcl_GetStringFromObj(objv[0], &slen); if (slen == 0) { CompileWord(envPtr, stringTokenPtr, interp, 2); } else { PushLiteral(envPtr, bytes, slen); - bytes = TclGetStringFromObj(objv[1], &slen); + bytes = Tcl_GetStringFromObj(objv[1], &slen); PushLiteral(envPtr, bytes, slen); CompileWord(envPtr, stringTokenPtr, interp, 2); OP(STR_MAP); @@ -2914,7 +2914,7 @@ TclCompileTryCmd( } if (objc > 0) { size_t len; - const char *varname = TclGetStringFromObj(objv[0], &len); + const char *varname = Tcl_GetStringFromObj(objv[0], &len); resultVarIndices[i] = LocalScalar(varname, len, envPtr); if (resultVarIndices[i] < 0) { @@ -2926,7 +2926,7 @@ TclCompileTryCmd( } if (objc == 2) { size_t len; - const char *varname = TclGetStringFromObj(objv[1], &len); + const char *varname = Tcl_GetStringFromObj(objv[1], &len); optionVarIndices[i] = LocalScalar(varname, len, envPtr); if (optionVarIndices[i] < 0) { @@ -3130,7 +3130,7 @@ IssueTryClausesInstructions( OP4( DICT_GET, 1); TclAdjustStackDepth(-1, envPtr); OP44( LIST_RANGE_IMM, 0, len-1); - p = TclGetStringFromObj(matchClauses[i], &slen); + p = Tcl_GetStringFromObj(matchClauses[i], &slen); PushLiteral(envPtr, p, slen); OP( STR_EQ); JUMP4( JUMP_FALSE, notECJumpSource); @@ -3342,7 +3342,7 @@ IssueTryClausesFinallyInstructions( OP4( DICT_GET, 1); TclAdjustStackDepth(-1, envPtr); OP44( LIST_RANGE_IMM, 0, len-1); - p = TclGetStringFromObj(matchClauses[i], &slen); + p = Tcl_GetStringFromObj(matchClauses[i], &slen); PushLiteral(envPtr, p, slen); OP( STR_EQ); JUMP4( JUMP_FALSE, notECJumpSource); @@ -3670,7 +3670,7 @@ TclCompileUnsetCmd( const char *bytes; size_t len; - bytes = TclGetStringFromObj(leadingWord, &len); + bytes = Tcl_GetStringFromObj(leadingWord, &len); if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) { flags = 0; haveFlags++; diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 2404916..847a240 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2352,7 +2352,7 @@ CompileExprTree( Tcl_DStringInit(&cmdName); TclDStringAppendLiteral(&cmdName, "tcl::mathfunc::"); - p = TclGetStringFromObj(*funcObjv, &length); + p = Tcl_GetStringFromObj(*funcObjv, &length); funcObjv++; Tcl_DStringAppend(&cmdName, p, length); TclEmitPush(TclRegisterLiteral(envPtr, @@ -2508,7 +2508,7 @@ CompileExprTree( if (optimize) { size_t length; - const char *bytes = TclGetStringFromObj(literal, &length); + const char *bytes = Tcl_GetStringFromObj(literal, &length); int idx = TclRegisterLiteral(envPtr, bytes, length, 0); Tcl_Obj *objPtr = TclFetchLiteral(envPtr, idx); @@ -2568,7 +2568,7 @@ CompileExprTree( Tcl_Obj *tableValue; size_t numBytes; const char *bytes - = TclGetStringFromObj(objPtr, &numBytes); + = Tcl_GetStringFromObj(objPtr, &numBytes); idx = TclRegisterLiteral(envPtr, bytes, numBytes, 0); tableValue = TclFetchLiteral(envPtr, idx); diff --git a/generic/tclCompile.c b/generic/tclCompile.c index b79bfe1..3f6bc12 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -785,7 +785,7 @@ TclSetByteCodeFromAny( } #endif - stringPtr = TclGetStringFromObj(objPtr, &length); + stringPtr = Tcl_GetStringFromObj(objPtr, &length); /* * TIP #280: Pick up the CmdFrame in which the BC compiler was invoked and @@ -1323,7 +1323,7 @@ CompileSubstObj( if (codePtr == NULL) { CompileEnv compEnv; size_t numBytes; - const char *bytes = TclGetStringFromObj(objPtr, &numBytes); + const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes); /* TODO: Check for more TIP 280 */ TclInitCompileEnv(interp, &compEnv, bytes, numBytes, NULL, 0); @@ -1812,7 +1812,7 @@ CompileCmdLiteral( extraLiteralFlags |= LITERAL_UNSHARED; } - bytes = TclGetStringFromObj(cmdObj, &length); + bytes = Tcl_GetStringFromObj(cmdObj, &length); cmdLitIdx = TclRegisterLiteral(envPtr, bytes, length, extraLiteralFlags); if (cmdPtr && TclRoutineHasName(cmdPtr)) { @@ -2784,7 +2784,7 @@ PreventCycle( * the intrep. */ size_t numBytes; - const char *bytes = TclGetStringFromObj(objPtr, &numBytes); + const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes); Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes); Tcl_IncrRefCount(copyPtr); @@ -3021,7 +3021,7 @@ TclFindCompiledLocal( varNamePtr = &cachePtr->varName0; for (i=0; i < cachePtr->numVars; varNamePtr++, i++) { if (*varNamePtr) { - localName = TclGetStringFromObj(*varNamePtr, &len); + localName = Tcl_GetStringFromObj(*varNamePtr, &len); if ((len == nameBytes) && !strncmp(name, localName, len)) { return i; } diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 87ba498..85e05e9 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -259,7 +259,7 @@ QueryConfigObjCmd( * Value is stored as-is in a byte array, see Bug [9b2e636361], * so we have to decode it first. */ - value = (const char *) TclGetByteArrayFromObj(val, &n); + value = (const char *) Tcl_GetByteArrayFromObj(val, &n); value = Tcl_ExternalToUtfDString(venc, value, n, &conv); Tcl_SetObjResult(interp, Tcl_NewStringObj(value, Tcl_DStringLength(&conv))); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 9a2e7a1..c5d71f0 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -145,7 +145,7 @@ EXTERN int Tcl_GetBoolean(Tcl_Interp *interp, const char *src, EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 33 */ -EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, +EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr); /* 34 */ EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src, @@ -166,7 +166,7 @@ EXTERN int Tcl_GetLongFromObj(Tcl_Interp *interp, /* 40 */ EXTERN const Tcl_ObjType * Tcl_GetObjType(const char *typeName); /* 41 */ -EXTERN char * Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr); +EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr); /* 42 */ EXTERN void Tcl_InvalidateStringRep(Tcl_Obj *objPtr); /* 43 */ @@ -1147,8 +1147,7 @@ EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, /* 433 */ EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel); /* 434 */ -EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, - int *lengthPtr); +EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr); /* Slot 435 is reserved */ /* Slot 436 is reserved */ /* 437 */ @@ -1751,6 +1750,17 @@ EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr, /* 648 */ EXTERN int * Tcl_UtfToUniCharDString(const char *src, size_t length, Tcl_DString *dsPtr); +/* Slot 649 is reserved */ +/* Slot 650 is reserved */ +/* 651 */ +EXTERN char * Tcl_GetStringFromObj(Tcl_Obj *objPtr, + size_t *lengthPtr); +/* 652 */ +EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, + size_t *lengthPtr); +/* 653 */ +EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, + size_t *lengthPtr); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -1811,7 +1821,7 @@ typedef struct TclStubs { void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */ int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */ int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */ - unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */ + unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */ int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */ int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */ void (*reserved36)(void); @@ -1819,7 +1829,7 @@ typedef struct TclStubs { int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */ int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */ const Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */ - char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */ + char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */ void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */ int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */ int (*tcl_ListObjAppendElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 44 */ @@ -2220,7 +2230,7 @@ typedef struct TclStubs { void * (*tcl_AttemptDbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 431 */ int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, size_t length); /* 432 */ Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */ - Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */ + Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */ void (*reserved435)(void); void (*reserved436)(void); Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */ @@ -2435,6 +2445,11 @@ typedef struct TclStubs { int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, size_t uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, size_t length, Tcl_DString *dsPtr); /* 648 */ + void (*reserved649)(void); + void (*reserved650)(void); + char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */ + Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */ + unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -2525,8 +2540,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_GetBoolean) /* 31 */ #define Tcl_GetBooleanFromObj \ (tclStubsPtr->tcl_GetBooleanFromObj) /* 32 */ -#define Tcl_GetByteArrayFromObj \ - (tclStubsPtr->tcl_GetByteArrayFromObj) /* 33 */ +#define TclGetByteArrayFromObj \ + (tclStubsPtr->tclGetByteArrayFromObj) /* 33 */ #define Tcl_GetDouble \ (tclStubsPtr->tcl_GetDouble) /* 34 */ #define Tcl_GetDoubleFromObj \ @@ -2540,8 +2555,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_GetLongFromObj) /* 39 */ #define Tcl_GetObjType \ (tclStubsPtr->tcl_GetObjType) /* 40 */ -#define Tcl_GetStringFromObj \ - (tclStubsPtr->tcl_GetStringFromObj) /* 41 */ +#define TclGetStringFromObj \ + (tclStubsPtr->tclGetStringFromObj) /* 41 */ #define Tcl_InvalidateStringRep \ (tclStubsPtr->tcl_InvalidateStringRep) /* 42 */ #define Tcl_ListObjAppendList \ @@ -3274,8 +3289,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_AttemptSetObjLength) /* 432 */ #define Tcl_GetChannelThread \ (tclStubsPtr->tcl_GetChannelThread) /* 433 */ -#define Tcl_GetUnicodeFromObj \ - (tclStubsPtr->tcl_GetUnicodeFromObj) /* 434 */ +#define TclGetUnicodeFromObj \ + (tclStubsPtr->tclGetUnicodeFromObj) /* 434 */ /* Slot 435 is reserved */ /* Slot 436 is reserved */ #define Tcl_SubstObj \ @@ -3701,6 +3716,14 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_UniCharToUtfDString) /* 647 */ #define Tcl_UtfToUniCharDString \ (tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */ +/* Slot 649 is reserved */ +/* Slot 650 is reserved */ +#define Tcl_GetStringFromObj \ + (tclStubsPtr->tcl_GetStringFromObj) /* 651 */ +#define Tcl_GetUnicodeFromObj \ + (tclStubsPtr->tcl_GetUnicodeFromObj) /* 652 */ +#define Tcl_GetByteArrayFromObj \ + (tclStubsPtr->tcl_GetByteArrayFromObj) /* 653 */ #endif /* defined(USE_TCL_STUBS) */ @@ -3822,6 +3845,30 @@ extern const TclStubs *tclStubsPtr; # endif #endif +#undef Tcl_GetStringFromObj +#undef Tcl_GetUnicodeFromObj +#undef Tcl_GetByteArrayFromObj +#undef Tcl_GetUnicode +#if defined(USE_TCL_STUBS) +#define Tcl_GetStringFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetStringFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetByteArrayFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicode(objPtr) \ + tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, NULL) +#else +#define Tcl_GetStringFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? (TclGetStringFromObj)(objPtr, (int *)sizePtr) : (Tcl_GetStringFromObj)(objPtr, (size_t *)sizePtr)) +#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? (TclGetByteArrayFromObj)(objPtr, (int *)sizePtr) : Tcl_GetByteArrayFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? (TclGetUnicodeFromObj)(objPtr, (int *)sizePtr) : Tcl_GetUnicodeFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicode(objPtr) \ + (Tcl_GetUnicodeFromObj)(objPtr, NULL) +#endif + #ifdef TCL_MEM_DEBUG # undef Tcl_Alloc # define Tcl_Alloc(x) \ @@ -3845,7 +3892,6 @@ extern const TclStubs *tclStubsPtr; #define Tcl_DbNewLongObj(value, file, line) Tcl_DbNewWideIntObj((long)(value), file, line) #define Tcl_SetIntObj(objPtr, value) Tcl_SetWideIntObj((objPtr), (int)(value)) #define Tcl_SetLongObj(objPtr, value) Tcl_SetWideIntObj((objPtr), (long)(value)) -#define Tcl_GetUnicode(objPtr) Tcl_GetUnicodeFromObj((objPtr), NULL) #define Tcl_BackgroundError(interp) Tcl_BackgroundException((interp), TCL_ERROR) #define Tcl_StringMatch(str, pattern) Tcl_StringCaseMatch((str), (pattern), 0) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 57f7d23..bb184a6 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -528,11 +528,11 @@ UpdateStringOfDict( flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 ); keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry); - elem = TclGetStringFromObj(keyPtr, &length); + elem = Tcl_GetStringFromObj(keyPtr, &length); bytesNeeded += TclScanElement(elem, length, flagPtr+i); flagPtr[i+1] = TCL_DONT_QUOTE_HASH; valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry); - elem = TclGetStringFromObj(valuePtr, &length); + elem = Tcl_GetStringFromObj(valuePtr, &length); bytesNeeded += TclScanElement(elem, length, flagPtr+i+1); } bytesNeeded += numElems; @@ -546,13 +546,13 @@ UpdateStringOfDict( for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) { flagPtr[i] |= ( i ? TCL_DONT_QUOTE_HASH : 0 ); keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry); - elem = TclGetStringFromObj(keyPtr, &length); + elem = Tcl_GetStringFromObj(keyPtr, &length); dst += TclConvertElement(elem, length, dst, flagPtr[i]); *dst++ = ' '; flagPtr[i+1] |= TCL_DONT_QUOTE_HASH; valuePtr = (Tcl_Obj *)Tcl_GetHashValue(&cPtr->entry); - elem = TclGetStringFromObj(valuePtr, &length); + elem = Tcl_GetStringFromObj(valuePtr, &length); dst += TclConvertElement(elem, length, dst, flagPtr[i+1]); *dst++ = ' '; } @@ -632,7 +632,7 @@ SetDictFromAny( } } else { size_t length; - const char *nextElem = TclGetStringFromObj(objPtr, &length); + const char *nextElem = Tcl_GetStringFromObj(objPtr, &length); const char *limit = (nextElem + length); while (nextElem < limit) { diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 1670cf4..5ac59e6 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -198,7 +198,7 @@ TclPrintObject( char *bytes; size_t length; - bytes = TclGetStringFromObj(objPtr, &length); + bytes = Tcl_GetStringFromObj(objPtr, &length); TclPrintSource(outFile, bytes, TclMin(length, maxChars)); } @@ -653,7 +653,7 @@ FormatInstruction( size_t length; Tcl_AppendToObj(bufferObj, "\t# ", -1); - bytes = TclGetStringFromObj(codePtr->objArrayPtr[opnd], &length); + bytes = Tcl_GetStringFromObj(codePtr->objArrayPtr[opnd], &length); PrintSourceToObj(bufferObj, bytes, TclMin(length, 40)); } else if (suffixBuffer[0]) { Tcl_AppendPrintfToObj(bufferObj, "\t# %s", suffixBuffer); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 7ded27e..1a19652 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -3699,7 +3699,7 @@ InitializeEncodingSearchPath( if (*encodingPtr) { ((Encoding *)(*encodingPtr))->refCount++; } - bytes = TclGetStringFromObj(searchPathObj, lengthPtr); + bytes = Tcl_GetStringFromObj(searchPathObj, lengthPtr); *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1); memcpy(*valuePtr, bytes, *lengthPtr + 1); Tcl_DecrRefCount(searchPathObj); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index e57fcb4..3c1f9ee 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -1811,7 +1811,7 @@ NsEnsembleImplementationCmdNR( size_t tableLength = ensemblePtr->subcommandTable.numEntries; Tcl_Obj *fix; - subcmdName = TclGetStringFromObj(subObj, &stringLength); + subcmdName = Tcl_GetStringFromObj(subObj, &stringLength); for (i=0 ; i<tableLength ; i++) { int cmp = strncmp(subcmdName, ensemblePtr->subcommandArrayPtr[i], @@ -2993,7 +2993,7 @@ TclCompileEnsemble( goto failed; } for (i=0 ; i<len ; i++) { - str = TclGetStringFromObj(elems[i], &sclen); + str = Tcl_GetStringFromObj(elems[i], &sclen); if ((sclen == numBytes) && !memcmp(word, str, numBytes)) { /* * Exact match! Excellent! @@ -3396,7 +3396,7 @@ CompileToInvokedCommand( for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++, tokPtr = TokenAfter(tokPtr)) { if (i > 0 && i < numWords+1) { - bytes = TclGetStringFromObj(words[i-1], &length); + bytes = Tcl_GetStringFromObj(words[i-1], &length); PushLiteral(envPtr, bytes, length); continue; } @@ -3425,7 +3425,7 @@ CompileToInvokedCommand( TclNewObj(objPtr); Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); - bytes = TclGetStringFromObj(objPtr, &length); + bytes = Tcl_GetStringFromObj(objPtr, &length); if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) { extraLiteralFlags |= LITERAL_UNSHARED; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 37132d2..e83ba63 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1437,7 +1437,7 @@ CompileExprObj( */ size_t length; - const char *string = TclGetStringFromObj(objPtr, &length); + const char *string = Tcl_GetStringFromObj(objPtr, &length); TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0); TclCompileExpr(interp, string, length, &compEnv, 0); @@ -4899,7 +4899,7 @@ TEBCresume( value2Ptr = OBJ_AT_TOS; valuePtr = OBJ_UNDER_TOS; - s1 = TclGetStringFromObj(valuePtr, &s1len); + s1 = Tcl_GetStringFromObj(valuePtr, &s1len); TRACE(("\"%.30s\" \"%.30s\" => ", O2S(valuePtr), O2S(value2Ptr))); if (TclListObjLength(interp, value2Ptr, &length) != TCL_OK) { TRACE_ERROR(interp); @@ -4917,7 +4917,7 @@ TEBCresume( do { Tcl_ListObjIndex(NULL, value2Ptr, i, &o); if (o != NULL) { - s2 = TclGetStringFromObj(o, &s2len); + s2 = Tcl_GetStringFromObj(o, &s2len); } else { s2 = ""; s2len = 0; @@ -5042,7 +5042,7 @@ TEBCresume( valuePtr = OBJ_AT_TOS; TRACE(("\"%.20s\" => ", O2S(valuePtr))); if (Tcl_IsShared(valuePtr)) { - s1 = TclGetStringFromObj(valuePtr, &slength); + s1 = Tcl_GetStringFromObj(valuePtr, &slength); TclNewStringObj(objResultPtr, s1, slength); slength = Tcl_UtfToUpper(TclGetString(objResultPtr)); Tcl_SetObjLength(objResultPtr, slength); @@ -5059,7 +5059,7 @@ TEBCresume( valuePtr = OBJ_AT_TOS; TRACE(("\"%.20s\" => ", O2S(valuePtr))); if (Tcl_IsShared(valuePtr)) { - s1 = TclGetStringFromObj(valuePtr, &slength); + s1 = Tcl_GetStringFromObj(valuePtr, &slength); TclNewStringObj(objResultPtr, s1, slength); slength = Tcl_UtfToLower(TclGetString(objResultPtr)); Tcl_SetObjLength(objResultPtr, slength); @@ -5076,7 +5076,7 @@ TEBCresume( valuePtr = OBJ_AT_TOS; TRACE(("\"%.20s\" => ", O2S(valuePtr))); if (Tcl_IsShared(valuePtr)) { - s1 = TclGetStringFromObj(valuePtr, &slength); + s1 = Tcl_GetStringFromObj(valuePtr, &slength); TclNewStringObj(objResultPtr, s1, slength); slength = Tcl_UtfToTitle(TclGetString(objResultPtr)); Tcl_SetObjLength(objResultPtr, slength); @@ -5112,7 +5112,7 @@ TEBCresume( TclNewObj(objResultPtr); } else if (TclIsPureByteArray(valuePtr)) { objResultPtr = Tcl_NewByteArrayObj( - Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1); + TclGetByteArrayFromObj(valuePtr, NULL)+index, 1); } else if (valuePtr->bytes && slength == valuePtr->length) { objResultPtr = Tcl_NewStringObj((const char *) valuePtr->bytes+index, 1); @@ -5304,12 +5304,12 @@ TEBCresume( objResultPtr = value3Ptr; goto doneStringMap; } - ustring1 = TclGetUnicodeFromObj(valuePtr, &slength); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &slength); if (slength == 0) { objResultPtr = valuePtr; goto doneStringMap; } - ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2); + ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2); if (length2 > slength || length2 == 0) { objResultPtr = valuePtr; goto doneStringMap; @@ -5321,7 +5321,7 @@ TEBCresume( } goto doneStringMap; } - ustring3 = TclGetUnicodeFromObj(value3Ptr, &length3); + ustring3 = Tcl_GetUnicodeFromObj(value3Ptr, &length3); objResultPtr = Tcl_NewUnicodeObj(ustring1, 0); p = ustring1; @@ -5372,7 +5372,7 @@ TEBCresume( valuePtr = OBJ_AT_TOS; TRACE(("%s \"%.30s\" => ", tclStringClassTable[opnd].name, O2S(valuePtr))); - ustring1 = TclGetUnicodeFromObj(valuePtr, &slength); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &slength); match = 1; if (slength > 0) { int ch; @@ -5403,16 +5403,16 @@ TEBCresume( || TclHasIntRep(value2Ptr, &tclStringType)) { Tcl_UniChar *ustring1, *ustring2; - ustring1 = TclGetUnicodeFromObj(valuePtr, &slength); - ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &slength); + ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2); match = TclUniCharMatch(ustring1, slength, ustring2, length2, nocase); } else if (TclIsPureByteArray(valuePtr) && !nocase) { unsigned char *bytes1, *bytes2; size_t wlen1 = 0, wlen2 = 0; - bytes1 = TclGetByteArrayFromObj(valuePtr, &wlen1); - bytes2 = TclGetByteArrayFromObj(value2Ptr, &wlen2); + bytes1 = Tcl_GetByteArrayFromObj(valuePtr, &wlen1); + bytes2 = Tcl_GetByteArrayFromObj(value2Ptr, &wlen2); match = TclByteArrayMatch(bytes1, wlen1, bytes2, wlen2, 0); } else { match = Tcl_StringCaseMatch(TclGetString(valuePtr), @@ -5439,24 +5439,24 @@ TEBCresume( case INST_STR_TRIM_LEFT: valuePtr = OBJ_UNDER_TOS; /* String */ value2Ptr = OBJ_AT_TOS; /* TrimSet */ - string2 = TclGetStringFromObj(value2Ptr, &length2); - string1 = TclGetStringFromObj(valuePtr, &slength); + string2 = Tcl_GetStringFromObj(value2Ptr, &length2); + string1 = Tcl_GetStringFromObj(valuePtr, &slength); trim1 = TclTrimLeft(string1, slength, string2, length2); trim2 = 0; goto createTrimmedString; case INST_STR_TRIM_RIGHT: valuePtr = OBJ_UNDER_TOS; /* String */ value2Ptr = OBJ_AT_TOS; /* TrimSet */ - string2 = TclGetStringFromObj(value2Ptr, &length2); - string1 = TclGetStringFromObj(valuePtr, &slength); + string2 = Tcl_GetStringFromObj(value2Ptr, &length2); + string1 = Tcl_GetStringFromObj(valuePtr, &slength); trim2 = TclTrimRight(string1, slength, string2, length2); trim1 = 0; goto createTrimmedString; case INST_STR_TRIM: valuePtr = OBJ_UNDER_TOS; /* String */ value2Ptr = OBJ_AT_TOS; /* TrimSet */ - string2 = TclGetStringFromObj(value2Ptr, &length2); - string1 = TclGetStringFromObj(valuePtr, &slength); + string2 = Tcl_GetStringFromObj(value2Ptr, &length2); + string1 = Tcl_GetStringFromObj(valuePtr, &slength); trim1 = TclTrim(string1, slength, string2, length2, &trim2); createTrimmedString: /* @@ -9474,7 +9474,7 @@ EvalStatsCmd( if (TclHasIntRep(entryPtr->objPtr, &tclByteCodeType)) { numByteCodeLits++; } - (void) TclGetStringFromObj(entryPtr->objPtr, &length); + (void) Tcl_GetStringFromObj(entryPtr->objPtr, &length); refCountSum += entryPtr->refCount; objBytesIfUnshared += (entryPtr->refCount * sizeof(Tcl_Obj)); strBytesIfUnshared += (entryPtr->refCount * (length+1)); @@ -9700,7 +9700,7 @@ EvalStatsCmd( Tcl_SetObjResult(interp, objPtr); } else { Tcl_Channel outChan; - char *str = TclGetStringFromObj(objv[1], &length); + char *str = Tcl_GetStringFromObj(objv[1], &length); if (length) { if (strcmp(str, "stdout") == 0) { diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index da3498c..4e37574 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -1391,7 +1391,7 @@ TclFileTemporaryCmd( if (objc > 2) { size_t length; Tcl_Obj *templateObj = objv[2]; - const char *string = TclGetStringFromObj(templateObj, &length); + const char *string = Tcl_GetStringFromObj(templateObj, &length); /* * Treat an empty string as if it wasn't there. @@ -1543,7 +1543,7 @@ TclFileTempDirCmd( if (objc > 1) { int length; Tcl_Obj *templateObj = objv[1]; - const char *string = TclGetStringFromObj(templateObj, &length); + const char *string = Tcl_GetStringFromObj(templateObj, &length); const int onWindows = (tclPlatform == TCL_PLATFORM_WINDOWS); /* diff --git a/generic/tclFileName.c b/generic/tclFileName.c index ca63a43..b58d23b 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -578,7 +578,7 @@ Tcl_SplitPath( size = 1; for (i = 0; i < *argcPtr; i++) { Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr); - (void)TclGetStringFromObj(eltPtr, &len); + (void)Tcl_GetStringFromObj(eltPtr, &len); size += len + 1; } @@ -598,7 +598,7 @@ Tcl_SplitPath( p = (char *) &(*argvPtr)[(*argcPtr) + 1]; for (i = 0; i < *argcPtr; i++) { Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr); - str = TclGetStringFromObj(eltPtr, &len); + str = Tcl_GetStringFromObj(eltPtr, &len); memcpy(p, str, len + 1); p += len+1; } @@ -861,7 +861,7 @@ TclpNativeJoinPath( const char *p; const char *start; - start = TclGetStringFromObj(prefix, &length); + start = Tcl_GetStringFromObj(prefix, &length); /* * Remove the ./ from tilde prefixed elements, and drive-letter prefixed @@ -889,7 +889,7 @@ TclpNativeJoinPath( if (length > 0 && (start[length-1] != '/')) { Tcl_AppendToObj(prefix, "/", 1); - (void)TclGetStringFromObj(prefix, &length); + (void)Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; @@ -925,7 +925,7 @@ TclpNativeJoinPath( if ((length > 0) && (start[length-1] != '/') && (start[length-1] != ':')) { Tcl_AppendToObj(prefix, "/", 1); - (void)TclGetStringFromObj(prefix, &length); + (void)Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; @@ -1009,7 +1009,7 @@ Tcl_JoinPath( * Store the result. */ - resultStr = TclGetStringFromObj(resultObj, &len); + resultStr = Tcl_GetStringFromObj(resultObj, &len); Tcl_DStringAppend(resultPtr, resultStr, len); Tcl_DecrRefCount(resultObj); @@ -1368,7 +1368,7 @@ Tcl_GlobObjCmd( if (dir == PATH_GENERAL) { size_t pathlength; const char *last; - const char *first = TclGetStringFromObj(pathOrDir,&pathlength); + const char *first = Tcl_GetStringFromObj(pathOrDir,&pathlength); /* * Find the last path separator in the path @@ -1471,7 +1471,7 @@ Tcl_GlobObjCmd( const char *str; Tcl_ListObjIndex(interp, typePtr, length, &look); - str = TclGetStringFromObj(look, &len); + str = Tcl_GetStringFromObj(look, &len); if (strcmp("readonly", str) == 0) { globTypes->perm |= TCL_GLOB_PERM_RONLY; } else if (strcmp("hidden", str) == 0) { @@ -2002,7 +2002,7 @@ TclGlob( Tcl_Panic("Called TclGlob with TCL_GLOBMODE_TAILS and pathPrefix==NULL"); } - pre = TclGetStringFromObj(pathPrefix, &prefixLen); + pre = Tcl_GetStringFromObj(pathPrefix, &prefixLen); if (prefixLen > 0 && (strchr(separators, pre[prefixLen-1]) == NULL)) { /* @@ -2020,7 +2020,7 @@ TclGlob( Tcl_ListObjGetElements(NULL, filenamesObj, &objc, &objv); for (i = 0; i< objc; i++) { size_t len; - const char *oldStr = TclGetStringFromObj(objv[i], &len); + const char *oldStr = Tcl_GetStringFromObj(objv[i], &len); Tcl_Obj *elem; if (len == prefixLen) { @@ -2372,7 +2372,7 @@ DoGlob( Tcl_Obj *fixme, *newObj; Tcl_ListObjIndex(NULL, matchesObj, repair, &fixme); - bytes = TclGetStringFromObj(fixme, &numBytes); + bytes = Tcl_GetStringFromObj(fixme, &numBytes); newObj = Tcl_NewStringObj(bytes+2, numBytes-2); Tcl_ListObjReplace(NULL, matchesObj, repair, 1, 1, &newObj); @@ -2410,7 +2410,7 @@ DoGlob( Tcl_DStringAppend(&append, pattern, p-pattern); if (pathPtr != NULL) { - (void) TclGetStringFromObj(pathPtr, &length); + (void) Tcl_GetStringFromObj(pathPtr, &length); } else { length = 0; } @@ -2456,7 +2456,7 @@ DoGlob( */ size_t len; - const char *joined = TclGetStringFromObj(joinedPtr,&len); + const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) { Tcl_AppendToObj(joinedPtr, "/", 1); @@ -2493,7 +2493,7 @@ DoGlob( */ size_t len; - const char *joined = TclGetStringFromObj(joinedPtr,&len); + const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) { if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) { diff --git a/generic/tclIO.c b/generic/tclIO.c index c747ff8..1c4279e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4140,7 +4140,7 @@ Tcl_WriteChars( } objPtr = Tcl_NewStringObj(src, len); - src = (char *) TclGetByteArrayFromObj(objPtr, &len); + src = (char *) Tcl_GetByteArrayFromObj(objPtr, &len); result = WriteBytes(chanPtr, src, len); TclDecrRefCount(objPtr); return result; @@ -4192,10 +4192,10 @@ Tcl_WriteObj( return TCL_IO_FAILURE; } if (statePtr->encoding == NULL) { - src = (char *) TclGetByteArrayFromObj(objPtr, &srcLen); + src = (char *) Tcl_GetByteArrayFromObj(objPtr, &srcLen); return WriteBytes(chanPtr, src, srcLen); } else { - src = TclGetStringFromObj(objPtr, &srcLen); + src = Tcl_GetStringFromObj(objPtr, &srcLen); return WriteChars(chanPtr, src, srcLen); } } @@ -4573,7 +4573,7 @@ Tcl_GetsObj( * newline in the available input. */ - (void)TclGetStringFromObj(objPtr, &oldLength); + (void)Tcl_GetStringFromObj(objPtr, &oldLength); oldFlags = statePtr->inputEncodingFlags; oldState = statePtr->inputEncodingState; oldRemoved = BUFFER_PADDING; @@ -4956,7 +4956,7 @@ TclGetsObjBinary( * newline in the available input. */ - byteArray = TclGetByteArrayFromObj(objPtr, &byteLen); + byteArray = Tcl_GetByteArrayFromObj(objPtr, &byteLen); oldFlags = statePtr->inputEncodingFlags; oldRemoved = BUFFER_PADDING; oldLength = byteLen; @@ -6108,7 +6108,7 @@ ReadChars( int factor = *factorPtr; int dstLimit = TCL_UTF_MAX - 1 + toRead * factor / UTF_EXPANSION_FACTOR; - (void) TclGetStringFromObj(objPtr, &numBytes); + (void) Tcl_GetStringFromObj(objPtr, &numBytes); Tcl_AppendToObj(objPtr, NULL, dstLimit); if (toRead == srcLen) { size_t size; @@ -9612,7 +9612,7 @@ CopyData( buffer = csPtr->buffer; sizeb = size; } else { - buffer = TclGetStringFromObj(bufObj, &sizeb); + buffer = Tcl_GetStringFromObj(bufObj, &sizeb); } if (outBinary || sameEncoding) { diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 5e40bc3..61aa585 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -456,7 +456,7 @@ Tcl_ReadObjCmd( const char *result; size_t length; - result = TclGetStringFromObj(resultPtr, &length); + result = Tcl_GetStringFromObj(resultPtr, &length); if (result[length - 1] == '\n') { Tcl_SetObjLength(resultPtr, length - 1); } @@ -703,7 +703,7 @@ Tcl_CloseObjCmd( resultPtr = Tcl_DuplicateObj(resultPtr); Tcl_SetObjResult(interp, resultPtr); } - string = TclGetStringFromObj(resultPtr, &len); + string = Tcl_GetStringFromObj(resultPtr, &len); if ((len > 0) && (string[len - 1] == '\n')) { Tcl_SetObjLength(resultPtr, len - 1); } @@ -983,7 +983,7 @@ Tcl_ExecObjCmd( */ if (keepNewline == 0) { - string = TclGetStringFromObj(resultPtr, &length); + string = Tcl_GetStringFromObj(resultPtr, &length); if ((length > 0) && (string[length - 1] == '\n')) { Tcl_SetObjLength(resultPtr, length - 1); } diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 01256255..0f113d3 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -440,7 +440,7 @@ ExecuteCallback( break; } resObj = Tcl_GetObjResult(eval); - resBuf = TclGetByteArrayFromObj(resObj, &resLen); + resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen); Tcl_WriteRaw(Tcl_GetStackedChannel(dataPtr->self), (char *) resBuf, resLen); break; @@ -450,13 +450,13 @@ ExecuteCallback( break; } resObj = Tcl_GetObjResult(eval); - resBuf = TclGetByteArrayFromObj(resObj, &resLen); + resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen); Tcl_WriteRaw(dataPtr->self, (char *) resBuf, resLen); break; case TRANSMIT_IBUF: resObj = Tcl_GetObjResult(eval); - resBuf = TclGetByteArrayFromObj(resObj, &resLen); + resBuf = Tcl_GetByteArrayFromObj(resObj, &resLen); ResultAdd(&dataPtr->result, resBuf, resLen); break; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 5bcd88b..fe6d1c1 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -1369,7 +1369,7 @@ ReflectInput( goto invalid; } - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); if ((size_t)toRead < bytec) { SetChannelErrorStr(rcPtr->chan, msg_read_toomuch); @@ -1993,7 +1993,7 @@ ReflectGetOption( goto error; } else { size_t len; - const char *str = TclGetStringFromObj(resObj, &len); + const char *str = Tcl_GetStringFromObj(resObj, &len); if (len) { TclDStringAppendLiteral(dsPtr, " "); @@ -2368,7 +2368,7 @@ InvokeTclMethod( if (result != TCL_ERROR) { size_t cmdLen; - const char *cmdString = TclGetStringFromObj(cmd, &cmdLen); + const char *cmdString = Tcl_GetStringFromObj(cmd, &cmdLen); Tcl_IncrRefCount(cmd); Tcl_ResetResult(rcPtr->interp); @@ -3039,7 +3039,7 @@ ForwardProc( size_t bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); if (paramPtr->input.toRead < bytec) { ForwardSetStaticError(paramPtr, msg_read_toomuch); @@ -3236,7 +3236,7 @@ ForwardProc( ForwardSetDynamicError(paramPtr, buf); } else { size_t len; - const char *str = TclGetStringFromObj(resObj, &len); + const char *str = Tcl_GetStringFromObj(resObj, &len); if (len) { TclDStringAppendLiteral(paramPtr->getOpt.value, " "); @@ -3335,7 +3335,7 @@ ForwardSetObjError( Tcl_Obj *obj) { size_t len; - const char *msgStr = TclGetStringFromObj(obj, &len); + const char *msgStr = Tcl_GetStringFromObj(obj, &len); len++; ForwardSetDynamicError(paramPtr, Tcl_Alloc(len)); diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 07891ad..b9b215e 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -2006,7 +2006,7 @@ InvokeTclMethod( if (result != TCL_ERROR) { Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv); size_t cmdLen; - const char *cmdString = TclGetStringFromObj(cmd, &cmdLen); + const char *cmdString = Tcl_GetStringFromObj(cmd, &cmdLen); Tcl_IncrRefCount(cmd); Tcl_ResetResult(rtPtr->interp); @@ -2565,7 +2565,7 @@ ForwardProc( unsigned char *bytev; /* Array of returned bytes */ - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); paramPtr->transform.size = bytec; @@ -2599,7 +2599,7 @@ ForwardProc( unsigned char *bytev; /* Array of returned bytes */ - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); paramPtr->transform.size = bytec; @@ -2628,7 +2628,7 @@ ForwardProc( size_t bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); paramPtr->transform.size = bytec; @@ -2655,7 +2655,7 @@ ForwardProc( unsigned char *bytev; /* Array of returned bytes */ - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); paramPtr->transform.size = bytec; @@ -2770,7 +2770,7 @@ ForwardSetObjError( Tcl_Obj *obj) { size_t len; - const char *msgStr = TclGetStringFromObj(obj, &len); + const char *msgStr = Tcl_GetStringFromObj(obj, &len); len++; ForwardSetDynamicError(paramPtr, Tcl_Alloc(len)); @@ -3055,7 +3055,7 @@ TransformRead( if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; - p.transform.buf = (char *) TclGetByteArrayFromObj(bufObj, + p.transform.buf = (char *) Tcl_GetByteArrayFromObj(bufObj, &(p.transform.size)); ForwardOpToOwnerThread(rtPtr, ForwardedInput, &p); @@ -3083,7 +3083,7 @@ TransformRead( return 0; } - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); ResultAdd(&rtPtr->result, bytev, bytec); Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */ @@ -3145,7 +3145,7 @@ TransformWrite( *errorCodePtr = EOK; - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); res = Tcl_WriteRaw(rtPtr->parent, (char *) bytev, bytec); Tcl_DecrRefCount(bufObj); @@ -3198,7 +3198,7 @@ TransformDrain( return 0; } - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); ResultAdd(&rtPtr->result, bytev, bytec); Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */ @@ -3254,7 +3254,7 @@ TransformFlush( } if (op == FLUSH_WRITE) { - bytev = TclGetByteArrayFromObj(resObj, &bytec); + bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); res = Tcl_WriteRaw(rtPtr->parent, (char *) bytev, bytec); } else { res = 0; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ee19025..36d8dbc 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -524,8 +524,8 @@ TclFSCwdPointerEquals( size_t len1, len2; const char *str1, *str2; - str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1); - str2 = TclGetStringFromObj(*pathPtrPtr, &len2); + str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1); + str2 = Tcl_GetStringFromObj(*pathPtrPtr, &len2); if ((len1 == len2) && !memcmp(str1, str2, len1)) { /* * The values are equal but the objects are different. Cache the @@ -668,7 +668,7 @@ FsUpdateCwd( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey); if (cwdObj != NULL) { - str = TclGetStringFromObj(cwdObj, &len); + str = Tcl_GetStringFromObj(cwdObj, &len); } Tcl_MutexLock(&cwdMutex); @@ -1157,8 +1157,8 @@ FsAddMountsToGlobResult( if (norm != NULL) { const char *path, *mount; - mount = TclGetStringFromObj(mElt, &mlen); - path = TclGetStringFromObj(norm, &len); + mount = Tcl_GetStringFromObj(mElt, &mlen); + path = Tcl_GetStringFromObj(norm, &len); if (path[len-1] == '/') { /* * Deal with the root of the volume. @@ -1338,7 +1338,7 @@ TclFSNormalizeToUniquePath( * We check these first to avoid useless calls to the native filesystem's * normalizePathProc. */ - path = TclGetStringFromObj(pathPtr, &i); + path = Tcl_GetStringFromObj(pathPtr, &i); if ( (i >= 3) && ( (path[0] == '/' && path[1] == '/') || (path[0] == '\\' && path[1] == '\\') ) ) { @@ -1773,7 +1773,7 @@ Tcl_FSEvalFileEx( oldScriptFile = iPtr->scriptFile; iPtr->scriptFile = pathPtr; Tcl_IncrRefCount(iPtr->scriptFile); - string = TclGetStringFromObj(objPtr, &length); + string = Tcl_GetStringFromObj(objPtr, &length); /* * TIP #280: Open a frame for the evaluated script. @@ -1800,7 +1800,7 @@ Tcl_FSEvalFileEx( * Record information about where the error occurred. */ - const char *pathString = TclGetStringFromObj(pathPtr, &length); + const char *pathString = Tcl_GetStringFromObj(pathPtr, &length); unsigned limit = 150; int overflow = (length > limit); @@ -1953,7 +1953,7 @@ EvalFileCallback( */ size_t length; - const char *pathString = TclGetStringFromObj(pathPtr, &length); + const char *pathString = Tcl_GetStringFromObj(pathPtr, &length); const unsigned int limit = 150; int overflow = (length > limit); @@ -2797,8 +2797,8 @@ Tcl_FSGetCwd( size_t len1, len2; const char *str1, *str2; - str1 = TclGetStringFromObj(tsdPtr->cwdPathPtr, &len1); - str2 = TclGetStringFromObj(norm, &len2); + str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1); + str2 = Tcl_GetStringFromObj(norm, &len2); if ((len1 == len2) && (strcmp(str1, str2) == 0)) { /* * The pathname values are equal so retain the old pathname @@ -3976,7 +3976,7 @@ TclGetPathType( * of the volume. */ { size_t pathLen; - const char *path = TclGetStringFromObj(pathPtr, &pathLen); + const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen); Tcl_PathType type; type = TclFSNonnativePathType(path, pathLen, filesystemPtrPtr, @@ -4083,7 +4083,7 @@ TclFSNonnativePathType( numVolumes--; Tcl_ListObjIndex(NULL, thisFsVolumes, numVolumes, &vol); - strVol = TclGetStringFromObj(vol,&len); + strVol = Tcl_GetStringFromObj(vol,&len); if ((size_t) pathLen < len) { continue; } @@ -4430,8 +4430,8 @@ Tcl_FSRemoveDirectory( Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr); if (normPath != NULL) { - normPathStr = TclGetStringFromObj(normPath, &normLen); - cwdStr = TclGetStringFromObj(cwdPtr, &cwdLen); + normPathStr = Tcl_GetStringFromObj(normPath, &normLen); + cwdStr = Tcl_GetStringFromObj(cwdPtr, &cwdLen); if ((cwdLen >= normLen) && (strncmp(normPathStr, cwdStr, normLen) == 0)) { /* diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 38474c7..02d0e31 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -615,10 +615,10 @@ PrefixAllObjCmd( return result; } resultPtr = Tcl_NewListObj(0, NULL); - string = TclGetStringFromObj(objv[2], &length); + string = Tcl_GetStringFromObj(objv[2], &length); for (t = 0; t < tableObjc; t++) { - elemString = TclGetStringFromObj(tableObjv[t], &elemLength); + elemString = Tcl_GetStringFromObj(tableObjv[t], &elemLength); /* * A prefix cannot match if it is longest. @@ -672,13 +672,13 @@ PrefixLongestObjCmd( if (result != TCL_OK) { return result; } - string = TclGetStringFromObj(objv[2], &length); + string = Tcl_GetStringFromObj(objv[2], &length); resultString = NULL; resultLength = 0; for (t = 0; t < tableObjc; t++) { - elemString = TclGetStringFromObj(tableObjv[t], &elemLength); + elemString = Tcl_GetStringFromObj(tableObjv[t], &elemLength); /* * First check if the prefix string matches the element. A prefix @@ -849,7 +849,7 @@ Tcl_WrongNumArgs( elementStr = EXPAND_OF(indexRep); elemLen = strlen(elementStr); } else { - elementStr = TclGetStringFromObj(origObjv[i], &elemLen); + elementStr = Tcl_GetStringFromObj(origObjv[i], &elemLen); } flags = 0; len = TclScanElement(elementStr, elemLen, &flags); @@ -899,7 +899,7 @@ Tcl_WrongNumArgs( * Quote the argument if it contains spaces (Bug 942757). */ - elementStr = TclGetStringFromObj(objv[i], &elemLen); + elementStr = Tcl_GetStringFromObj(objv[i], &elemLen); flags = 0; len = TclScanElement(elementStr, elemLen, &flags); @@ -1024,7 +1024,7 @@ Tcl_ParseArgsObjv( curArg = objv[srcIndex]; srcIndex++; objc--; - str = TclGetStringFromObj(curArg, &length); + str = Tcl_GetStringFromObj(curArg, &length); if (length > 0) { c = str[1]; } else { diff --git a/generic/tclInt.h b/generic/tclInt.h index d8fe381..3816eff 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4419,39 +4419,6 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclGetString(objPtr) \ ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString(objPtr)) -#if 0 - static inline char *TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lenPtr) { - char *response = Tcl_GetString(objPtr); - *(lenPtr) = objPtr->length; - return response; - } - static inline Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lenPtr) { - Tcl_UniChar *response = Tcl_GetUnicodeFromObj(objPtr, NULL); - *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1); - return response; - } - static inline unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lenPtr) { - unsigned char *response = Tcl_GetByteArrayFromObj(objPtr, NULL); - if (response) { - *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1 + 1); - } - return response; - } -#else -#define TclGetStringFromObj(objPtr, lenPtr) \ - (((objPtr)->bytes \ - ? NULL : Tcl_GetString((objPtr)), \ - *(lenPtr) = (objPtr)->length, (objPtr)->bytes)) -#define TclGetUnicodeFromObj(objPtr, lenPtr) \ - (Tcl_GetUnicodeFromObj((objPtr), NULL), \ - *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \ - Tcl_GetUnicodeFromObj((objPtr), NULL)) -#define TclGetByteArrayFromObj(objPtr, lenPtr) \ - (Tcl_GetByteArrayFromObj((objPtr), NULL) ? \ - (*(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1 + 1), \ - (unsigned char *)(((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1) + 3)) : NULL) -#endif - /* *---------------------------------------------------------------- * Macro used by the Tcl core to clean out an object's internal diff --git a/generic/tclInterp.c b/generic/tclInterp.c index a609953..c9111d2 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -4597,7 +4597,7 @@ ChildCommandLimitCmd( switch ((enum Options) index) { case OPT_CMD: scriptObj = objv[i+1]; - (void) TclGetStringFromObj(scriptObj, &scriptLen); + (void) Tcl_GetStringFromObj(scriptObj, &scriptLen); break; case OPT_GRAN: granObj = objv[i+1]; @@ -4614,7 +4614,7 @@ ChildCommandLimitCmd( break; case OPT_VAL: limitObj = objv[i+1]; - (void) TclGetStringFromObj(objv[i+1], &limitLen); + (void) Tcl_GetStringFromObj(objv[i+1], &limitLen); if (limitLen == 0) { break; } @@ -4807,7 +4807,7 @@ ChildTimeLimitCmd( switch ((enum Options) index) { case OPT_CMD: scriptObj = objv[i+1]; - (void) TclGetStringFromObj(objv[i+1], &scriptLen); + (void) Tcl_GetStringFromObj(objv[i+1], &scriptLen); break; case OPT_GRAN: granObj = objv[i+1]; @@ -4824,7 +4824,7 @@ ChildTimeLimitCmd( break; case OPT_MILLI: milliObj = objv[i+1]; - (void) TclGetStringFromObj(objv[i+1], &milliLen); + (void) Tcl_GetStringFromObj(objv[i+1], &milliLen); if (milliLen == 0) { break; } @@ -4842,7 +4842,7 @@ ChildTimeLimitCmd( break; case OPT_SEC: secObj = objv[i+1]; - (void) TclGetStringFromObj(objv[i+1], &secLen); + (void) Tcl_GetStringFromObj(objv[i+1], &secLen); if (secLen == 0) { break; } diff --git a/generic/tclLink.c b/generic/tclLink.c index d8f7b54..e1ddce6 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -634,7 +634,7 @@ SetInvalidRealFromAny( size_t length; const char *str, *endPtr; - str = TclGetStringFromObj(objPtr, &length); + str = Tcl_GetStringFromObj(objPtr, &length); if ((length == 1) && (str[0] == '.')) { objPtr->typePtr = &invalidRealType; objPtr->internalRep.doubleValue = 0.0; @@ -679,7 +679,7 @@ GetInvalidIntFromObj( int *intPtr) { size_t length; - const char *str = TclGetStringFromObj(objPtr, &length); + const char *str = Tcl_GetStringFromObj(objPtr, &length); if ((length == 0) || ((length == 2) && (str[0] == '0') && strchr("xXbBoOdD", str[1]))) { @@ -897,7 +897,7 @@ LinkTraceProc( switch (linkPtr->type) { case TCL_LINK_STRING: - value = TclGetStringFromObj(valueObj, &valueLength); + value = Tcl_GetStringFromObj(valueObj, &valueLength); pp = (char **) linkPtr->addr; *pp = (char *)Tcl_Realloc(*pp, ++valueLength); @@ -905,7 +905,7 @@ LinkTraceProc( return NULL; case TCL_LINK_CHARS: - value = (char *) TclGetStringFromObj(valueObj, &valueLength); + value = (char *) Tcl_GetStringFromObj(valueObj, &valueLength); valueLength++; /* include end of string char */ if (valueLength > linkPtr->bytes) { return (char *) "wrong size of char* value"; @@ -920,7 +920,7 @@ LinkTraceProc( return NULL; case TCL_LINK_BINARY: - value = (char *) TclGetByteArrayFromObj(valueObj, &valueLength); + value = (char *) Tcl_GetByteArrayFromObj(valueObj, &valueLength); if (valueLength != linkPtr->bytes) { return (char *) "wrong size of binary value"; } diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 16cd75e..9feaf3c 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -540,7 +540,7 @@ Tcl_ListObjGetElements( int result; size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { *objcPtr = 0; *objvPtr = NULL; @@ -664,7 +664,7 @@ Tcl_ListObjAppendElement( int result; size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { Tcl_SetListObj(listPtr, 1, &objPtr); return TCL_OK; @@ -839,7 +839,7 @@ Tcl_ListObjIndex( int result; size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { *objPtrPtr = NULL; return TCL_OK; @@ -896,7 +896,7 @@ Tcl_ListObjLength( int result; size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { *intPtr = 0; return TCL_OK; @@ -973,7 +973,7 @@ Tcl_ListObjReplace( if (listRepPtr == NULL) { size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { if (objc == 0) { return TCL_OK; @@ -1784,7 +1784,7 @@ TclListObjSetElement( int result; size_t length; - (void) TclGetStringFromObj(listPtr, &length); + (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2020,7 +2020,7 @@ SetListFromAny( } else { int estCount; size_t length; - const char *limit, *nextElem = TclGetStringFromObj(objPtr, &length); + const char *limit, *nextElem = Tcl_GetStringFromObj(objPtr, &length); /* * Allocate enough space to hold a (Tcl_Obj *) for each @@ -2163,7 +2163,7 @@ UpdateStringOfList( elemPtrs = &listRepPtr->elements; for (i = 0; i < numElems; i++) { flagPtr[i] = (i ? TCL_DONT_QUOTE_HASH : 0); - elem = TclGetStringFromObj(elemPtrs[i], &length); + elem = Tcl_GetStringFromObj(elemPtrs[i], &length); bytesNeeded += TclScanElement(elem, length, flagPtr+i); } bytesNeeded += numElems - 1; @@ -2176,7 +2176,7 @@ UpdateStringOfList( TclOOM(dst, bytesNeeded); for (i = 0; i < numElems; i++) { flagPtr[i] |= (i ? TCL_DONT_QUOTE_HASH : 0); - elem = TclGetStringFromObj(elemPtrs[i], &length); + elem = Tcl_GetStringFromObj(elemPtrs[i], &length); dst += TclConvertElement(elem, length, dst, flagPtr[i]); *dst++ = ' '; } diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index a75c9cf..cc34cac 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -211,7 +211,7 @@ TclCreateLiteral( */ size_t objLength; - const char *objBytes = TclGetStringFromObj(objPtr, &objLength); + const char *objBytes = Tcl_GetStringFromObj(objPtr, &objLength); if ((objLength == length) && ((length == 0) || ((objBytes[0] == bytes[0]) @@ -510,7 +510,7 @@ LookupLiteralEntry( const char *bytes; size_t globalHash, length; - bytes = TclGetStringFromObj(objPtr, &length); + bytes = Tcl_GetStringFromObj(objPtr, &length); globalHash = (HashString(bytes, length) & globalTablePtr->mask); for (entryPtr=globalTablePtr->buckets[globalHash] ; entryPtr!=NULL; entryPtr=entryPtr->nextPtr) { @@ -571,7 +571,7 @@ TclHideLiteral( TclReleaseLiteral(interp, lPtr->objPtr); lPtr->objPtr = newObjPtr; - bytes = TclGetStringFromObj(newObjPtr, &length); + bytes = Tcl_GetStringFromObj(newObjPtr, &length); localHash = HashString(bytes, length) & localTablePtr->mask; nextPtrPtr = &localTablePtr->buckets[localHash]; @@ -704,7 +704,7 @@ AddLocalLiteralEntry( } if (!found) { - bytes = TclGetStringFromObj(objPtr, &length); + bytes = Tcl_GetStringFromObj(objPtr, &length); Tcl_Panic("%s: literal \"%.*s\" wasn't found locally", "AddLocalLiteralEntry", (length>60? 60 : (int)length), bytes); } @@ -833,7 +833,7 @@ TclReleaseLiteral( } globalTablePtr = &iPtr->literalTable; - bytes = TclGetStringFromObj(objPtr, &length); + bytes = Tcl_GetStringFromObj(objPtr, &length); index = HashString(bytes, length) & globalTablePtr->mask; /* @@ -1005,7 +1005,7 @@ RebuildLiteralTable( for (oldChainPtr=oldBuckets ; oldSize>0 ; oldSize--,oldChainPtr++) { for (entryPtr=*oldChainPtr ; entryPtr!=NULL ; entryPtr=*oldChainPtr) { - bytes = TclGetStringFromObj(entryPtr->objPtr, &length); + bytes = Tcl_GetStringFromObj(entryPtr->objPtr, &length); index = (HashString(bytes, length) & tablePtr->mask); *oldChainPtr = entryPtr->nextPtr; @@ -1176,7 +1176,7 @@ TclVerifyLocalLiteralTable( localPtr=localPtr->nextPtr) { count++; if (localPtr->refCount != TCL_INDEX_NONE) { - bytes = TclGetStringFromObj(localPtr->objPtr, &length); + bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length); Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u", "TclVerifyLocalLiteralTable", (length>60? 60 : (int) length), bytes, localPtr->refCount); @@ -1225,7 +1225,7 @@ TclVerifyGlobalLiteralTable( globalPtr=globalPtr->nextPtr) { count++; if (globalPtr->refCount + 1 < 2) { - bytes = TclGetStringFromObj(globalPtr->objPtr, &length); + bytes = Tcl_GetStringFromObj(globalPtr->objPtr, &length); Tcl_Panic("%s: global literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u", "TclVerifyGlobalLiteralTable", (length>60? 60 : (int)length), bytes, globalPtr->refCount); diff --git a/generic/tclMain.c b/generic/tclMain.c index 943ca84..f175319 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -511,7 +511,7 @@ Tcl_MainEx( * error messages troubles deeper in, so lop it back off. */ - (void)TclGetStringFromObj(is.commandPtr, &length); + (void)Tcl_GetStringFromObj(is.commandPtr, &length); Tcl_SetObjLength(is.commandPtr, --length); code = Tcl_RecordAndEvalObj(interp, is.commandPtr, TCL_EVAL_GLOBAL); @@ -528,7 +528,7 @@ Tcl_MainEx( } else if (is.tty) { resultPtr = Tcl_GetObjResult(interp); Tcl_IncrRefCount(resultPtr); - (void)TclGetStringFromObj(resultPtr, &length); + (void)Tcl_GetStringFromObj(resultPtr, &length); chan = Tcl_GetStdChannel(TCL_STDOUT); if ((length > 0) && chan) { Tcl_WriteObj(chan, resultPtr); @@ -772,7 +772,7 @@ StdinProc( goto prompt; } isPtr->prompt = PROMPT_START; - (void)TclGetStringFromObj(commandPtr, &length); + (void)Tcl_GetStringFromObj(commandPtr, &length); Tcl_SetObjLength(commandPtr, --length); /* @@ -804,7 +804,7 @@ StdinProc( chan = Tcl_GetStdChannel(TCL_STDOUT); Tcl_IncrRefCount(resultPtr); - (void)TclGetStringFromObj(resultPtr, &length); + (void)Tcl_GetStringFromObj(resultPtr, &length); if ((length > 0) && (chan != NULL)) { Tcl_WriteObj(chan, resultPtr); Tcl_WriteChars(chan, "\n", 1); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 4826235..b2d717b 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -3133,7 +3133,7 @@ NamespaceCodeCmd( " "namespace" command. [Bug 3202171]. */ - arg = TclGetStringFromObj(objv[1], &length); + arg = Tcl_GetStringFromObj(objv[1], &length); if (*arg==':' && length > 20 && strncmp(arg, "::namespace inscope ", 20) == 0) { Tcl_SetObjResult(interp, objv[1]); diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 21c85d8..eb929c8 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -208,7 +208,7 @@ TclOO_Class_Create( "objectName ?arg ...?"); return TCL_ERROR; } - objName = TclGetStringFromObj( + objName = Tcl_GetStringFromObj( objv[Tcl_ObjectContextSkippedArgs(context)], &len); if (len == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -273,7 +273,7 @@ TclOO_Class_CreateNs( "objectName namespaceName ?arg ...?"); return TCL_ERROR; } - objName = TclGetStringFromObj( + objName = Tcl_GetStringFromObj( objv[Tcl_ObjectContextSkippedArgs(context)], &len); if (len == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -281,7 +281,7 @@ TclOO_Class_CreateNs( Tcl_SetErrorCode(interp, "TCL", "OO", "EMPTY_NAME", NULL); return TCL_ERROR; } - nsName = TclGetStringFromObj( + nsName = Tcl_GetStringFromObj( objv[Tcl_ObjectContextSkippedArgs(context)+1], &len); if (len == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index b87d5ed..8831056 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -716,7 +716,7 @@ TclOOUnknownDefinition( return TCL_ERROR; } - soughtStr = TclGetStringFromObj(objv[1], &soughtLen); + soughtStr = Tcl_GetStringFromObj(objv[1], &soughtLen); if (soughtLen == 0) { goto noMatch; } @@ -778,7 +778,7 @@ FindCommand( Tcl_Namespace *const namespacePtr) { size_t length; - const char *nameStr, *string = TclGetStringFromObj(stringObj, &length); + const char *nameStr, *string = Tcl_GetStringFromObj(stringObj, &length); Namespace *const nsPtr = (Namespace *) namespacePtr; FOREACH_HASH_DECLS; Tcl_Command cmd, cmd2; @@ -999,7 +999,7 @@ GenerateErrorInfo( size_t length; Tcl_Obj *realNameObj = Tcl_ObjectDeleted((Tcl_Object) oPtr) ? savedNameObj : TclOOObjectName(interp, oPtr); - const char *objName = TclGetStringFromObj(realNameObj, &length); + const char *objName = Tcl_GetStringFromObj(realNameObj, &length); unsigned limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT; int overflow = (length > limit); @@ -1550,7 +1550,7 @@ TclOODefineConstructorObjCmd( } clsPtr = oPtr->classPtr; - (void)TclGetStringFromObj(objv[2], &bodyLength); + (void)Tcl_GetStringFromObj(objv[2], &bodyLength); if (bodyLength > 0) { /* * Create the method structure. @@ -1756,7 +1756,7 @@ TclOODefineDestructorObjCmd( } clsPtr = oPtr->classPtr; - (void)TclGetStringFromObj(objv[1], &bodyLength); + (void)Tcl_GetStringFromObj(objv[1], &bodyLength); if (bodyLength > 0) { /* * Create the method structure. diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index d3bd428..eb43adf 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1017,12 +1017,12 @@ ProcedureMethodCompiledVarConnect( * either. */ - varName = TclGetStringFromObj(infoPtr->variableObj, &varLen); + varName = Tcl_GetStringFromObj(infoPtr->variableObj, &varLen); if (contextPtr->callPtr->chain[contextPtr->index] .mPtr->declaringClassPtr != NULL) { FOREACH_STRUCT(privateVar, contextPtr->callPtr->chain[contextPtr->index] .mPtr->declaringClassPtr->privateVariables) { - match = TclGetStringFromObj(privateVar->variableObj, &len); + match = Tcl_GetStringFromObj(privateVar->variableObj, &len); if ((len == varLen) && !memcmp(match, varName, len)) { variableObj = privateVar->fullNameObj; cacheIt = 0; @@ -1031,7 +1031,7 @@ ProcedureMethodCompiledVarConnect( } FOREACH(variableObj, contextPtr->callPtr->chain[contextPtr->index] .mPtr->declaringClassPtr->variables) { - match = TclGetStringFromObj(variableObj, &len); + match = Tcl_GetStringFromObj(variableObj, &len); if ((len == varLen) && !memcmp(match, varName, len)) { cacheIt = 0; goto gotMatch; @@ -1039,7 +1039,7 @@ ProcedureMethodCompiledVarConnect( } } else { FOREACH_STRUCT(privateVar, contextPtr->oPtr->privateVariables) { - match = TclGetStringFromObj(privateVar->variableObj, &len); + match = Tcl_GetStringFromObj(privateVar->variableObj, &len); if ((len == varLen) && !memcmp(match, varName, len)) { variableObj = privateVar->fullNameObj; cacheIt = 1; @@ -1047,7 +1047,7 @@ ProcedureMethodCompiledVarConnect( } } FOREACH(variableObj, contextPtr->oPtr->variables) { - match = TclGetStringFromObj(variableObj, &len); + match = Tcl_GetStringFromObj(variableObj, &len); if ((len == varLen) && !memcmp(match, varName, len)) { cacheIt = 1; goto gotMatch; @@ -1187,7 +1187,7 @@ MethodErrorHandler( CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData; Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr; const char *objectName, *kindName, *methodName = - TclGetStringFromObj(mPtr->namePtr, &nameLen); + Tcl_GetStringFromObj(mPtr->namePtr, &nameLen); Object *declarerPtr; if (mPtr->declaringObjectPtr != NULL) { @@ -1201,7 +1201,7 @@ MethodErrorHandler( kindName = "class"; } - objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr), + objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr), &objectNameLen); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (%s \"%.*s%s\" method \"%.*s%s\" line %d)", @@ -1232,7 +1232,7 @@ ConstructorErrorHandler( kindName = "class"; } - objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr), + objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr), &objectNameLen); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (%s \"%.*s%s\" constructor line %d)", kindName, @@ -1262,7 +1262,7 @@ DestructorErrorHandler( kindName = "class"; } - objectName = TclGetStringFromObj(TclOOObjectName(interp, declarerPtr), + objectName = Tcl_GetStringFromObj(TclOOObjectName(interp, declarerPtr), &objectNameLen); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (%s \"%.*s%s\" destructor line %d)", kindName, diff --git a/generic/tclObj.c b/generic/tclObj.c index 28aa058..a793d1c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -621,7 +621,7 @@ TclContinuationsEnterDerived( * better way which doesn't shimmer?) */ - (void)TclGetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); end = start + length; /* First char after the word */ /* @@ -1620,7 +1620,7 @@ Tcl_GetString( /* *---------------------------------------------------------------------- * - * Tcl_GetStringFromObj -- + * Tcl_GetStringFromObj/TclGetStringFromObj -- * * Returns the string representation's byte array pointer and length for * an object. @@ -1640,8 +1640,9 @@ Tcl_GetString( *---------------------------------------------------------------------- */ +#undef TclGetStringFromObj char * -Tcl_GetStringFromObj( +TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should * be returned. */ int *lengthPtr) /* If non-NULL, the location where the string @@ -1678,6 +1679,51 @@ Tcl_GetStringFromObj( } return objPtr->bytes; } + +#undef Tcl_GetStringFromObj +char * +Tcl_GetStringFromObj( + Tcl_Obj *objPtr, /* Object whose string rep byte pointer should + * be returned. */ + size_t *lengthPtr) /* If non-NULL, the location where the string + * rep's byte array length should * be stored. + * If NULL, no length is stored. */ +{ + if (objPtr->bytes == NULL) { + /* + * Note we do not check for objPtr->typePtr == NULL. An invariant + * of a properly maintained Tcl_Obj is that at least one of + * objPtr->bytes and objPtr->typePtr must not be NULL. If broken + * extensions fail to maintain that invariant, we can crash here. + */ + + if (objPtr->typePtr->updateStringProc == NULL) { + /* + * Those Tcl_ObjTypes which choose not to define an + * updateStringProc must be written in such a way that + * (objPtr->bytes) never becomes NULL. + */ + Tcl_Panic("UpdateStringProc should not be invoked for type %s", + objPtr->typePtr->name); + } + objPtr->typePtr->updateStringProc(objPtr); + if (objPtr->bytes == NULL + || objPtr->bytes[objPtr->length] != '\0') { + Tcl_Panic("UpdateStringProc for type '%s' " + "failed to create a valid string rep", + objPtr->typePtr->name); + } + } + if (lengthPtr != NULL) { +#if TCL_MAJOR_VERSION > 8 + *lengthPtr = objPtr->length; +#else + *lengthPtr = ((size_t)(unsigned)(objPtr->length + 1)) - 1; +#endif + } + return objPtr->bytes; +} + /* *---------------------------------------------------------------------- @@ -2008,7 +2054,7 @@ TclSetBooleanFromAny( badBoolean: if (interp != NULL) { size_t length; - const char *str = TclGetStringFromObj(objPtr, &length); + const char *str = Tcl_GetStringFromObj(objPtr, &length); Tcl_Obj *msg; TclNewLiteralStringObj(msg, "expected boolean value but got \""); @@ -2027,7 +2073,7 @@ ParseBoolean( int newBool; char lowerCase[6]; size_t i, length; - const char *str = TclGetStringFromObj(objPtr, &length); + const char *str = Tcl_GetStringFromObj(objPtr, &length); if ((length == 0) || (length > 5)) { /* @@ -2443,6 +2489,7 @@ Tcl_GetIntFromObj( return TCL_OK; #endif } + /* *---------------------------------------------------------------------- @@ -3868,8 +3915,8 @@ TclHashObjKey( void *keyPtr) /* Key from which to compute hash value. */ { Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr; - const char *string = TclGetString(objPtr); - size_t length = objPtr->length; + size_t length; + const char *string = Tcl_GetStringFromObj(objPtr, &length); TCL_HASH_TYPE result = 0; /* diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index 6d5b09b..fef6c26 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -233,7 +233,7 @@ ConvertZeroEffectToNOP( TclGetUInt1AtPtr(currentInstPtr + 1)); size_t numBytes; - (void) TclGetStringFromObj(litPtr, &numBytes); + (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { blank = size + InstLength(nextInst); } @@ -248,7 +248,7 @@ ConvertZeroEffectToNOP( TclGetUInt4AtPtr(currentInstPtr + 1)); size_t numBytes; - (void) TclGetStringFromObj(litPtr, &numBytes); + (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { blank = size + InstLength(nextInst); } diff --git a/generic/tclParse.c b/generic/tclParse.c index 8d18f75..f894906 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -2200,7 +2200,7 @@ TclSubstTokens( if (result == 0) { clPos = 0; } else { - (void)TclGetStringFromObj(result, &clPos); + (void)Tcl_GetStringFromObj(result, &clPos); } if (numCL >= maxNumCL) { @@ -2476,7 +2476,7 @@ TclObjCommandComplete( * check. */ { size_t length; - const char *script = TclGetStringFromObj(objPtr, &length); + const char *script = Tcl_GetStringFromObj(objPtr, &length); return CommandComplete(script, length); } diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index e6ca973..95a0a64 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -212,7 +212,7 @@ TclFSNormalizeAbsolutePath( retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } - (void)TclGetStringFromObj(retVal, &curLen); + (void)Tcl_GetStringFromObj(retVal, &curLen); if (curLen == 0) { Tcl_AppendToObj(retVal, dirSep, 1); } @@ -238,7 +238,7 @@ TclFSNormalizeAbsolutePath( retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } - (void)TclGetStringFromObj(retVal, &curLen); + (void)Tcl_GetStringFromObj(retVal, &curLen); if (curLen == 0) { Tcl_AppendToObj(retVal, dirSep, 1); } @@ -269,7 +269,7 @@ TclFSNormalizeAbsolutePath( */ const char *path = - TclGetStringFromObj(retVal, &curLen); + Tcl_GetStringFromObj(retVal, &curLen); while (curLen-- > 0) { if (IsSeparatorOrNull(path[curLen])) { @@ -284,7 +284,7 @@ TclFSNormalizeAbsolutePath( Tcl_SetObjLength(retVal, curLen+1); Tcl_AppendObjToObj(retVal, linkObj); TclDecrRefCount(linkObj); - linkStr = TclGetStringFromObj(retVal, &curLen); + linkStr = Tcl_GetStringFromObj(retVal, &curLen); } else { /* * Absolute link. @@ -297,7 +297,7 @@ TclFSNormalizeAbsolutePath( } else { retVal = linkObj; } - linkStr = TclGetStringFromObj(retVal, &curLen); + linkStr = Tcl_GetStringFromObj(retVal, &curLen); /* * Convert to forward-slashes on windows. @@ -314,7 +314,7 @@ TclFSNormalizeAbsolutePath( } } } else { - linkStr = TclGetStringFromObj(retVal, &curLen); + linkStr = Tcl_GetStringFromObj(retVal, &curLen); } /* @@ -385,7 +385,7 @@ TclFSNormalizeAbsolutePath( if (tclPlatform == TCL_PLATFORM_WINDOWS) { size_t len; - const char *path = TclGetStringFromObj(retVal, &len); + const char *path = Tcl_GetStringFromObj(retVal, &len); if (len == 2 && path[0] != 0 && path[1] == ':') { if (Tcl_IsShared(retVal)) { @@ -559,7 +559,7 @@ TclPathPart( */ size_t numBytes; - const char *rest = TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes); + const char *rest = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes); if (strchr(rest, '/') != NULL) { goto standardPath; @@ -596,7 +596,7 @@ TclPathPart( */ size_t numBytes; - const char *rest = TclGetStringFromObj(fsPathPtr->normPathPtr, &numBytes); + const char *rest = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes); if (strchr(rest, '/') != NULL) { goto standardPath; @@ -625,7 +625,7 @@ TclPathPart( const char *fileName, *extension; size_t length; - fileName = TclGetStringFromObj(fsPathPtr->normPathPtr, + fileName = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &length); extension = TclGetExtension(fileName); if (extension == NULL) { @@ -677,7 +677,7 @@ TclPathPart( size_t length; const char *fileName, *extension; - fileName = TclGetStringFromObj(pathPtr, &length); + fileName = Tcl_GetStringFromObj(pathPtr, &length); extension = TclGetExtension(fileName); if (extension == NULL) { Tcl_IncrRefCount(pathPtr); @@ -868,7 +868,7 @@ TclJoinPath( const char *str; size_t len; - str = TclGetStringFromObj(tailObj, &len); + str = Tcl_GetStringFromObj(tailObj, &len); if (len == 0) { /* * This happens if we try to handle the root volume '/'. @@ -940,7 +940,7 @@ TclJoinPath( Tcl_Obj *driveName = NULL; Tcl_Obj *elt = objv[i]; - strElt = TclGetStringFromObj(elt, &strEltLen); + strElt = Tcl_GetStringFromObj(elt, &strEltLen); driveNameLength = 0; /* if forceRelative - all paths excepting first one are relative */ type = (forceRelative && (i > 0)) ? TCL_PATH_RELATIVE : @@ -1037,7 +1037,7 @@ TclJoinPath( if (res == NULL) { TclNewObj(res); } - ptr = TclGetStringFromObj(res, &length); + ptr = Tcl_GetStringFromObj(res, &length); /* * Strip off any './' before a tilde, unless this is the beginning of @@ -1082,7 +1082,7 @@ TclJoinPath( if (length > 0 && ptr[length -1] != '/') { Tcl_AppendToObj(res, &separator, 1); - (void)TclGetStringFromObj(res, &length); + (void)Tcl_GetStringFromObj(res, &length); } Tcl_SetObjLength(res, length + strlen(strElt)); @@ -1351,7 +1351,7 @@ AppendPath( * intrep produce the same results; that is, bugward compatibility. If * we need to fix that bug here, it needs fixing in TclJoinPath() too. */ - bytes = TclGetStringFromObj(tail, &length); + bytes = Tcl_GetStringFromObj(tail, &length); if (length == 0) { Tcl_AppendToObj(copy, "/", 1); } else { @@ -1411,7 +1411,7 @@ TclFSMakePathRelative( * too little below, leading to wrong answers returned by glob. */ - tempStr = TclGetStringFromObj(cwdPtr, &cwdLen); + tempStr = Tcl_GetStringFromObj(cwdPtr, &cwdLen); /* * Should we perhaps use 'Tcl_FSPathSeparator'? But then what about the @@ -1431,7 +1431,7 @@ TclFSMakePathRelative( } break; } - tempStr = TclGetStringFromObj(pathPtr, &len); + tempStr = Tcl_GetStringFromObj(pathPtr, &len); return Tcl_NewStringObj(tempStr + cwdLen, len - cwdLen); } @@ -1657,7 +1657,7 @@ Tcl_FSGetTranslatedStringPath( if (transPtr != NULL) { size_t len; - const char *orig = TclGetStringFromObj(transPtr, &len); + const char *orig = Tcl_GetStringFromObj(transPtr, &len); char *result = (char *)Tcl_Alloc(len+1); memcpy(result, orig, len+1); @@ -1717,7 +1717,7 @@ Tcl_FSGetNormalizedPath( /* TODO: Figure out why this is needed. */ TclGetString(pathPtr); - (void)TclGetStringFromObj(fsPathPtr->normPathPtr, &tailLen); + (void)Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &tailLen); if (tailLen) { copy = AppendPath(dir, fsPathPtr->normPathPtr); } else { @@ -1730,7 +1730,7 @@ Tcl_FSGetNormalizedPath( * We now own a reference on both 'dir' and 'copy' */ - (void) TclGetStringFromObj(dir, &cwdLen); + (void) Tcl_GetStringFromObj(dir, &cwdLen); /* Normalize the combined string. */ @@ -1813,7 +1813,7 @@ Tcl_FSGetNormalizedPath( copy = AppendPath(fsPathPtr->cwdPtr, pathPtr); - (void) TclGetStringFromObj(fsPathPtr->cwdPtr, &cwdLen); + (void) Tcl_GetStringFromObj(fsPathPtr->cwdPtr, &cwdLen); cwdLen += (TclGetString(copy)[cwdLen] == '/'); /* @@ -2151,8 +2151,8 @@ Tcl_FSEqualPaths( if (firstPtr == NULL || secondPtr == NULL) { return 0; } - firstStr = TclGetStringFromObj(firstPtr, &firstLen); - secondStr = TclGetStringFromObj(secondPtr, &secondLen); + firstStr = Tcl_GetStringFromObj(firstPtr, &firstLen); + secondStr = Tcl_GetStringFromObj(secondPtr, &secondLen); if ((firstLen == secondLen) && !memcmp(firstStr, secondStr, firstLen)) { return 1; } @@ -2171,8 +2171,8 @@ Tcl_FSEqualPaths( return 0; } - firstStr = TclGetStringFromObj(firstPtr, &firstLen); - secondStr = TclGetStringFromObj(secondPtr, &secondLen); + firstStr = Tcl_GetStringFromObj(firstPtr, &firstLen); + secondStr = Tcl_GetStringFromObj(secondPtr, &secondLen); return ((firstLen == secondLen) && !memcmp(firstStr, secondStr, firstLen)); } @@ -2225,7 +2225,7 @@ SetFsPathFromAny( * cmdAH.test exercise most of the code). */ - name = TclGetStringFromObj(pathPtr, &len); + name = Tcl_GetStringFromObj(pathPtr, &len); /* * Handle tilde substitutions, if needed. @@ -2482,7 +2482,7 @@ UpdateStringOfFsPath( Tcl_IncrRefCount(copy); /* Steal copy's string rep */ - pathPtr->bytes = TclGetStringFromObj(copy, &cwdLen); + pathPtr->bytes = Tcl_GetStringFromObj(copy, &cwdLen); pathPtr->length = cwdLen; TclInitStringRep(copy, NULL, 0); TclDecrRefCount(copy); @@ -2542,7 +2542,7 @@ TclNativePathInFilesystem( size_t len; - (void) TclGetStringFromObj(pathPtr, &len); + (void) Tcl_GetStringFromObj(pathPtr, &len); if (len == 0) { /* * We reject the empty path "". diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 67f5adc..d0adfac 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -1182,7 +1182,7 @@ TclNRPackageObjCmd( } else { pkgPtr = FindPackage(interp, argv2); } - argv3 = TclGetStringFromObj(objv[3], &length); + argv3 = Tcl_GetStringFromObj(objv[3], &length); for (availPtr = pkgPtr->availPtr, prevPtr = NULL; availPtr != NULL; prevPtr = availPtr, availPtr = availPtr->nextPtr) { @@ -1229,10 +1229,10 @@ TclNRPackageObjCmd( } } if (iPtr->scriptFile) { - argv4 = TclGetStringFromObj(iPtr->scriptFile, &length); + argv4 = Tcl_GetStringFromObj(iPtr->scriptFile, &length); DupBlock(availPtr->pkgIndex, argv4, length + 1); } - argv4 = TclGetStringFromObj(objv[4], &length); + argv4 = Tcl_GetStringFromObj(objv[4], &length); DupBlock(availPtr->script, argv4, length + 1); break; } @@ -1409,7 +1409,7 @@ TclNRPackageObjCmd( if (iPtr->packageUnknown != NULL) { Tcl_Free(iPtr->packageUnknown); } - argv2 = TclGetStringFromObj(objv[2], &length); + argv2 = Tcl_GetStringFromObj(objv[2], &length); if (argv2[0] == 0) { iPtr->packageUnknown = NULL; } else { @@ -2074,7 +2074,7 @@ AddRequirementsToResult( size_t length; for (i = 0; i < reqc; i++) { - const char *v = TclGetStringFromObj(reqv[i], &length); + const char *v = Tcl_GetStringFromObj(reqv[i], &length); if ((length & 0x1) && (v[length/2] == '-') && (strncmp(v, v+((length+1)/2), length/2) == 0)) { diff --git a/generic/tclProc.c b/generic/tclProc.c index ebe42ff..46e7858 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -352,7 +352,7 @@ Tcl_ProcObjCmd( * The argument list is just "args"; check the body */ - procBody = TclGetStringFromObj(objv[3], &numBytes); + procBody = Tcl_GetStringFromObj(objv[3], &numBytes); if (TclParseAllWhiteSpace(procBody, numBytes) < numBytes) { goto done; } @@ -447,7 +447,7 @@ TclCreateProc( size_t length; Tcl_Obj *sharedBodyPtr = bodyPtr; - bytes = TclGetStringFromObj(bodyPtr, &length); + bytes = Tcl_GetStringFromObj(bodyPtr, &length); bodyPtr = Tcl_NewStringObj(bytes, length); /* @@ -538,7 +538,7 @@ TclCreateProc( goto procError; } - argname = TclGetStringFromObj(fieldValues[0], &nameLength); + argname = Tcl_GetStringFromObj(fieldValues[0], &nameLength); /* * Check that the formal parameter name is a scalar. @@ -601,8 +601,8 @@ TclCreateProc( if (localPtr->defValuePtr != NULL) { size_t tmpLength, valueLength; - const char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr, &tmpLength); - const char *value = TclGetStringFromObj(fieldValues[1], &valueLength); + const char *tmpPtr = Tcl_GetStringFromObj(localPtr->defValuePtr, &tmpLength); + const char *value = Tcl_GetStringFromObj(fieldValues[1], &valueLength); if ((valueLength != tmpLength) || memcmp(value, tmpPtr, tmpLength) != 0 @@ -2034,7 +2034,7 @@ MakeProcError( { unsigned int overflow, limit = 60; size_t nameLen; - const char *procName = TclGetStringFromObj(procNameObj, &nameLen); + const char *procName = Tcl_GetStringFromObj(procNameObj, &nameLen); overflow = (nameLen > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( @@ -2705,7 +2705,7 @@ MakeLambdaError( { unsigned int overflow, limit = 60; size_t nameLen; - const char *procName = TclGetStringFromObj(procNameObj, &nameLen); + const char *procName = Tcl_GetStringFromObj(procNameObj, &nameLen); overflow = (nameLen > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index c397848..c40165f 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -481,7 +481,7 @@ Tcl_RegExpExecObj( regexpPtr->string = NULL; regexpPtr->objPtr = textObj; - udata = TclGetUnicodeFromObj(textObj, &length); + udata = Tcl_GetUnicodeFromObj(textObj, &length); if (offset > length) { offset = length; @@ -600,7 +600,7 @@ Tcl_GetRegExpFromObj( RegexpGetIntRep(objPtr, regexpPtr); if ((regexpPtr == NULL) || (regexpPtr->flags != flags)) { - pattern = TclGetStringFromObj(objPtr, &length); + pattern = Tcl_GetStringFromObj(objPtr, &length); regexpPtr = CompileRegexp(interp, pattern, length, flags); if (regexpPtr == NULL) { diff --git a/generic/tclResult.c b/generic/tclResult.c index 08287cb..83bfd04 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -362,7 +362,7 @@ Tcl_AppendElement( if (Tcl_IsShared(iPtr->objResultPtr)) { Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr)); } - bytes = TclGetStringFromObj(iPtr->objResultPtr, &length); + bytes = Tcl_GetStringFromObj(iPtr->objResultPtr, &length); if (TclNeedSpace(bytes, bytes + length)) { Tcl_AppendToObj(iPtr->objResultPtr, " ", 1); } @@ -723,7 +723,7 @@ TclProcessReturn( if (valuePtr != NULL) { size_t length; - (void) TclGetStringFromObj(valuePtr, &length); + (void) Tcl_GetStringFromObj(valuePtr, &length); if (length) { iPtr->errorInfo = valuePtr; Tcl_IncrRefCount(iPtr->errorInfo); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c52c888..c0a8a65 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -5183,23 +5183,23 @@ TclFormatNaN( #else union { double dv; - unsigned long long iv; + uint64_t iv; } bitwhack; bitwhack.dv = value; if (n770_fp) { bitwhack.iv = Nokia770Twiddle(bitwhack.iv); } - if (bitwhack.iv & (1ULL << 63)) { - bitwhack.iv &= ~ (1ULL << 63); + if (bitwhack.iv & (UINT64_C(1) << 63)) { + bitwhack.iv &= ~ (UINT64_C(1) << 63); *buffer++ = '-'; } *buffer++ = 'N'; *buffer++ = 'a'; *buffer++ = 'N'; - bitwhack.iv &= ((1ULL) << 51) - 1; + bitwhack.iv &= ((UINT64_C(1)) << 51) - 1; if (bitwhack.iv != 0) { - sprintf(buffer, "(%" TCL_LL_MODIFIER "x)", bitwhack.iv); + sprintf(buffer, "(%" PRIx64 ")", bitwhack.iv); } else { *buffer = '\0'; } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 22172ff..8466bd3 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -418,7 +418,7 @@ Tcl_GetCharLength( */ if (TclIsPureByteArray(objPtr)) { - (void) TclGetByteArrayFromObj(objPtr, &numChars); + (void) Tcl_GetByteArrayFromObj(objPtr, &numChars); return numChars; } @@ -517,7 +517,7 @@ Tcl_GetUniChar( if (TclIsPureByteArray(objPtr)) { size_t length = 0; - unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &length); + unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length); if (index >= length) { return -1; } @@ -573,7 +573,7 @@ Tcl_GetUniChar( /* *---------------------------------------------------------------------- * - * Tcl_GetUnicodeFromObj -- + * Tcl_GetUnicodeFromObj/TclGetUnicodeFromObj -- * * Get the Unicode form of the String object with length. If the object * is not already a String object, it will be converted to one. If the @@ -589,8 +589,9 @@ Tcl_GetUniChar( *---------------------------------------------------------------------- */ +#undef Tcl_GetUnicodeFromObj Tcl_UniChar * -Tcl_GetUnicodeFromObj( +TclGetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string * for. */ int *lengthPtr) /* If non-NULL, the location where the string @@ -608,6 +609,30 @@ Tcl_GetUnicodeFromObj( } if (lengthPtr != NULL) { + *lengthPtr = (int)stringPtr->numChars; + } + return stringPtr->unicode; +} + +Tcl_UniChar * +Tcl_GetUnicodeFromObj( + Tcl_Obj *objPtr, /* The object to find the unicode string + * for. */ + size_t *lengthPtr) /* If non-NULL, the location where the string + * rep's unichar length should be stored. If + * NULL, no length is stored. */ +{ + String *stringPtr; + + SetStringFromAny(NULL, objPtr); + stringPtr = GET_STRING(objPtr); + + if (stringPtr->hasUnicode == 0) { + FillUnicodeRep(objPtr); + stringPtr = GET_STRING(objPtr); + } + + if (lengthPtr != NULL) { *lengthPtr = stringPtr->numChars; } return stringPtr->unicode; @@ -655,7 +680,7 @@ Tcl_GetRange( */ if (TclIsPureByteArray(objPtr)) { - unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &length); + unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length); if (last >= length) { last = length - 1; @@ -1287,8 +1312,8 @@ Tcl_AppendObjToObj( size_t lengthSrc = 0; - (void) TclGetByteArrayFromObj(objPtr, &length); - (void) TclGetByteArrayFromObj(appendObjPtr, &lengthSrc); + (void) Tcl_GetByteArrayFromObj(objPtr, &length); + (void) Tcl_GetByteArrayFromObj(appendObjPtr, &lengthSrc); /* * Grow buffer enough for the append. @@ -1308,7 +1333,7 @@ Tcl_AppendObjToObj( */ TclAppendBytesToByteArray(objPtr, - Tcl_GetByteArrayFromObj(appendObjPtr, NULL), lengthSrc); + TclGetByteArrayFromObj(appendObjPtr, NULL), lengthSrc); return; } @@ -1331,11 +1356,11 @@ Tcl_AppendObjToObj( if (TclHasIntRep(appendObjPtr, &tclStringType)) { Tcl_UniChar *unicode = - TclGetUnicodeFromObj(appendObjPtr, &numChars); + Tcl_GetUnicodeFromObj(appendObjPtr, &numChars); AppendUnicodeToUnicodeRep(objPtr, unicode, numChars); } else { - bytes = TclGetStringFromObj(appendObjPtr, &length); + bytes = Tcl_GetStringFromObj(appendObjPtr, &length); AppendUtfToUnicodeRep(objPtr, bytes, length); } return; @@ -1347,7 +1372,7 @@ Tcl_AppendObjToObj( * characters in the final (appended-to) object. */ - bytes = TclGetStringFromObj(appendObjPtr, &length); + bytes = Tcl_GetStringFromObj(appendObjPtr, &length); numChars = stringPtr->numChars; if ((numChars != TCL_INDEX_NONE) && TclHasIntRep(appendObjPtr, &tclStringType)) { @@ -1690,7 +1715,7 @@ Tcl_AppendFormatToObj( if (Tcl_IsShared(appendObj)) { Tcl_Panic("%s called with shared object", "Tcl_AppendFormatToObj"); } - (void)TclGetStringFromObj(appendObj, &originalLength); + (void)Tcl_GetStringFromObj(appendObj, &originalLength); limit = (size_t)INT_MAX - originalLength; /* @@ -2084,7 +2109,7 @@ Tcl_AppendFormatToObj( TclNewIntObj(pure, l); } Tcl_IncrRefCount(pure); - bytes = TclGetStringFromObj(pure, &length); + bytes = Tcl_GetStringFromObj(pure, &length); /* * Already did the sign above. @@ -2368,7 +2393,7 @@ Tcl_AppendFormatToObj( } } - (void)TclGetStringFromObj(segment, &segmentNumBytes); + (void)Tcl_GetStringFromObj(segment, &segmentNumBytes); if (segmentNumBytes > limit) { if (allocSegment) { Tcl_DecrRefCount(segment); @@ -2720,7 +2745,7 @@ TclGetStringStorage( String *stringPtr; if (!TclHasIntRep(objPtr, &tclStringType) || objPtr->bytes == NULL) { - return TclGetStringFromObj(objPtr, sizePtr); + return Tcl_GetStringFromObj(objPtr, sizePtr); } stringPtr = GET_STRING(objPtr); @@ -2777,13 +2802,13 @@ TclStringRepeat( if (binary) { /* Result will be pure byte array. Pre-size it */ - (void)TclGetByteArrayFromObj(objPtr, &length); + (void)Tcl_GetByteArrayFromObj(objPtr, &length); } else if (unichar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ - (void)TclGetUnicodeFromObj(objPtr, &length); + (void)Tcl_GetUnicodeFromObj(objPtr, &length); } else { /* Result will be concat of string reps. Pre-size it. */ - (void)TclGetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); } if (length == 0) { @@ -2812,7 +2837,7 @@ TclStringRepeat( done *= 2; } TclAppendBytesToByteArray(objResultPtr, - Tcl_GetByteArrayFromObj(objResultPtr, NULL), + TclGetByteArrayFromObj(objResultPtr, NULL), (count - done) * length); } else if (unichar) { /* @@ -2973,7 +2998,7 @@ TclStringCat( */ if (TclIsPureByteArray(objPtr)) { - (void)TclGetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ + (void)Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { last = objc - oc; @@ -2997,7 +3022,7 @@ TclStringCat( if ((objPtr->bytes == NULL) || (objPtr->length)) { size_t numChars; - (void)TclGetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ + (void)Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ if (numChars) { last = objc - oc; if (length == 0) { @@ -3028,7 +3053,7 @@ TclStringCat( /* No string rep; Take the chance we can avoid making it */ pendingPtr = objPtr; } else { - (void)TclGetStringFromObj(objPtr, &length); /* PANIC? */ + (void)Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ } } while (--oc && (length == 0) && (pendingPtr == NULL)); @@ -3054,14 +3079,14 @@ TclStringCat( do { Tcl_Obj *objPtr = *ov++; - (void)TclGetStringFromObj(objPtr, &numBytes); /* PANIC? */ + (void)Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ } while (--oc && numBytes == 0 && pendingPtr->bytes == NULL); if (numBytes) { last = objc -oc -1; } if (oc || numBytes) { - (void)TclGetStringFromObj(pendingPtr, &length); + (void)Tcl_GetStringFromObj(pendingPtr, &length); } if (length == 0) { if (numBytes) { @@ -3114,7 +3139,7 @@ TclStringCat( size_t start = 0; objResultPtr = *objv++; objc--; - (void)TclGetByteArrayFromObj(objResultPtr, &start); + (void)Tcl_GetByteArrayFromObj(objResultPtr, &start); dst = Tcl_SetByteArrayLength(objResultPtr, length) + start; } else { objResultPtr = Tcl_NewByteArrayObj(NULL, length); @@ -3131,7 +3156,7 @@ TclStringCat( if (TclIsPureByteArray(objPtr)) { size_t more = 0; - unsigned char *src = TclGetByteArrayFromObj(objPtr, &more); + unsigned char *src = Tcl_GetByteArrayFromObj(objPtr, &more); memcpy(dst, src, more); dst += more; } @@ -3146,7 +3171,7 @@ TclStringCat( objResultPtr = *objv++; objc--; /* Ugly interface! Force resize of the unicode array. */ - (void)TclGetUnicodeFromObj(objResultPtr, &start); + (void)Tcl_GetUnicodeFromObj(objResultPtr, &start); Tcl_InvalidateStringRep(objResultPtr); if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { @@ -3182,7 +3207,7 @@ TclStringCat( if ((objPtr->bytes == NULL) || (objPtr->length)) { size_t more; - Tcl_UniChar *src = TclGetUnicodeFromObj(objPtr, &more); + Tcl_UniChar *src = Tcl_GetUnicodeFromObj(objPtr, &more); memcpy(dst, src, more * sizeof(Tcl_UniChar)); dst += more; } @@ -3196,7 +3221,7 @@ TclStringCat( objResultPtr = *objv++; objc--; - (void)TclGetStringFromObj(objResultPtr, &start); + (void)Tcl_GetStringFromObj(objResultPtr, &start); if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3229,7 +3254,7 @@ TclStringCat( if ((objPtr->bytes == NULL) || (objPtr->length)) { size_t more; - char *src = TclGetStringFromObj(objPtr, &more); + char *src = Tcl_GetStringFromObj(objPtr, &more); memcpy(dst, src, more); dst += more; @@ -3293,8 +3318,8 @@ TclStringCmp( * arrays anyway, and we have no memcasecmp() for some reason... :^) */ - s1 = (char *) TclGetByteArrayFromObj(value1Ptr, &s1len); - s2 = (char *) TclGetByteArrayFromObj(value2Ptr, &s2len); + s1 = (char *) Tcl_GetByteArrayFromObj(value1Ptr, &s1len); + s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len); memCmpFn = memcmp; } else if (TclHasIntRep(value1Ptr, &tclStringType) && TclHasIntRep(value2Ptr, &tclStringType)) { @@ -3306,8 +3331,8 @@ TclStringCmp( */ if (nocase) { - s1 = (char *) TclGetUnicodeFromObj(value1Ptr, &s1len); - s2 = (char *) TclGetUnicodeFromObj(value2Ptr, &s2len); + s1 = (char *) Tcl_GetUnicodeFromObj(value1Ptr, &s1len); + s2 = (char *) Tcl_GetUnicodeFromObj(value2Ptr, &s2len); memCmpFn = (memCmpFn_t)TclUniCharNcasecmp; } else { s1len = Tcl_GetCharLength(value1Ptr); @@ -3344,7 +3369,7 @@ TclStringCmp( case -1: s1 = 0; s1len = 0; - s2 = TclGetStringFromObj(value2Ptr, &s2len); + s2 = Tcl_GetStringFromObj(value2Ptr, &s2len); break; case 0: match = -1; @@ -3359,7 +3384,7 @@ TclStringCmp( case -1: s2 = 0; s2len = 0; - s1 = TclGetStringFromObj(value1Ptr, &s1len); + s1 = Tcl_GetStringFromObj(value1Ptr, &s1len); break; case 0: match = 1; @@ -3370,8 +3395,8 @@ TclStringCmp( goto matchdone; } } else { - s1 = TclGetStringFromObj(value1Ptr, &s1len); - s2 = TclGetStringFromObj(value2Ptr, &s2len); + s1 = Tcl_GetStringFromObj(value1Ptr, &s1len); + s2 = Tcl_GetStringFromObj(value2Ptr, &s2len); } if (!nocase && checkEq) { /* @@ -3473,10 +3498,10 @@ TclStringFirst( if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { unsigned char *end, *check, *bh; - unsigned char *bn = TclGetByteArrayFromObj(needle, &ln); + unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); /* Find bytes in bytes */ - bh = TclGetByteArrayFromObj(haystack, &lh); + bh = Tcl_GetByteArrayFromObj(haystack, &lh); if ((lh < ln) || (start > lh - ln)) { /* Don't start the loop if there cannot be a valid answer */ goto firstEnd; @@ -3519,8 +3544,8 @@ TclStringFirst( * do only the well-defined Tcl_UniChar array search. */ - un = TclGetUnicodeFromObj(needle, &ln); - uh = TclGetUnicodeFromObj(haystack, &lh); + un = Tcl_GetUnicodeFromObj(needle, &ln); + uh = Tcl_GetUnicodeFromObj(haystack, &lh); if ((lh < ln) || (start > lh - ln)) { /* Don't start the loop if there cannot be a valid answer */ goto firstEnd; @@ -3579,8 +3604,8 @@ TclStringLast( } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *check, *bh = TclGetByteArrayFromObj(haystack, &lh); - unsigned char *bn = TclGetByteArrayFromObj(needle, &ln); + unsigned char *check, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); + unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); if (last + 1 >= lh + 1) { last = lh - 1; @@ -3602,8 +3627,8 @@ TclStringLast( goto lastEnd; } - uh = TclGetUnicodeFromObj(haystack, &lh); - un = TclGetUnicodeFromObj(needle, &ln); + uh = Tcl_GetUnicodeFromObj(haystack, &lh); + un = Tcl_GetUnicodeFromObj(needle, &ln); if (last + 1 >= lh + 1) { last = lh - 1; @@ -3679,12 +3704,12 @@ TclStringReverse( if (TclIsPureByteArray(objPtr)) { size_t numBytes = 0; - unsigned char *from = TclGetByteArrayFromObj(objPtr, &numBytes); + unsigned char *from = Tcl_GetByteArrayFromObj(objPtr, &numBytes); if (!inPlace || Tcl_IsShared(objPtr)) { objPtr = Tcl_NewByteArrayObj(NULL, numBytes); } - ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, NULL), from, numBytes); + ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, (size_t *)NULL), from, numBytes); return objPtr; } @@ -3829,7 +3854,7 @@ TclStringReplace( if (TclIsPureByteArray(objPtr)) { size_t numBytes = 0; - unsigned char *bytes = TclGetByteArrayFromObj(objPtr, &numBytes); + unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &numBytes); if (insertPtr == NULL) { /* Replace something with nothing. */ @@ -3853,7 +3878,7 @@ TclStringReplace( if (TclIsPureByteArray(insertPtr)) { size_t newBytes = 0; unsigned char *iBytes - = TclGetByteArrayFromObj(insertPtr, &newBytes); + = Tcl_GetByteArrayFromObj(insertPtr, &newBytes); if (count == newBytes && inPlace && !Tcl_IsShared(objPtr)) { /* @@ -3897,7 +3922,7 @@ TclStringReplace( /* The traditional implementation... */ { size_t numChars; - Tcl_UniChar *ustring = TclGetUnicodeFromObj(objPtr, &numChars); + Tcl_UniChar *ustring = Tcl_GetUnicodeFromObj(objPtr, &numChars); /* TODO: Is there an in-place option worth pursuing here? */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 81dd726..d1ff41a 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -791,7 +791,7 @@ const TclStubs tclStubs = { TclFreeObj, /* 30 */ Tcl_GetBoolean, /* 31 */ Tcl_GetBooleanFromObj, /* 32 */ - Tcl_GetByteArrayFromObj, /* 33 */ + TclGetByteArrayFromObj, /* 33 */ Tcl_GetDouble, /* 34 */ Tcl_GetDoubleFromObj, /* 35 */ 0, /* 36 */ @@ -799,7 +799,7 @@ const TclStubs tclStubs = { Tcl_GetIntFromObj, /* 38 */ Tcl_GetLongFromObj, /* 39 */ Tcl_GetObjType, /* 40 */ - Tcl_GetStringFromObj, /* 41 */ + TclGetStringFromObj, /* 41 */ Tcl_InvalidateStringRep, /* 42 */ Tcl_ListObjAppendList, /* 43 */ Tcl_ListObjAppendElement, /* 44 */ @@ -1200,7 +1200,7 @@ const TclStubs tclStubs = { Tcl_AttemptDbCkrealloc, /* 431 */ Tcl_AttemptSetObjLength, /* 432 */ Tcl_GetChannelThread, /* 433 */ - Tcl_GetUnicodeFromObj, /* 434 */ + TclGetUnicodeFromObj, /* 434 */ 0, /* 435 */ 0, /* 436 */ Tcl_SubstObj, /* 437 */ @@ -1415,6 +1415,11 @@ const TclStubs tclStubs = { Tcl_UtfToUniChar, /* 646 */ Tcl_UniCharToUtfDString, /* 647 */ Tcl_UtfToUniCharDString, /* 648 */ + 0, /* 649 */ + 0, /* 650 */ + Tcl_GetStringFromObj, /* 651 */ + Tcl_GetUnicodeFromObj, /* 652 */ + Tcl_GetByteArrayFromObj, /* 653 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclTest.c b/generic/tclTest.c index fd26cc6..df61dbb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -4773,7 +4773,7 @@ GetTimesObjCmd( Tcl_Free(objv); /* TclGetString 100000 times */ - fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n"); + fprintf(stderr, "Tcl_GetStringFromObj of \"12345\" 100000 times\n"); objPtr = Tcl_NewStringObj("12345", -1); Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { @@ -4781,7 +4781,7 @@ GetTimesObjCmd( } Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); - fprintf(stderr, " %.3f usec per TclGetStringFromObj of \"12345\"\n", + fprintf(stderr, " %.3f usec per Tcl_GetStringFromObj of \"12345\"\n", timePer/100000); /* Tcl_GetIntFromObj 100000 times */ diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index dcfb2d1..7de787e 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1168,6 +1168,7 @@ TeststringobjCmd( { Tcl_UniChar *unicode; int varIndex, option, i, length; + size_t size; #define MAX_STRINGS 11 const char *index, *string, *strings[MAX_STRINGS+1]; String *strPtr; @@ -1300,12 +1301,12 @@ TeststringobjCmd( * is "copy on write". */ - string = Tcl_GetStringFromObj(objv[3], &length); + string = Tcl_GetStringFromObj(objv[3], &size); if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) { - Tcl_SetStringObj(varPtr[varIndex], string, length); + Tcl_SetStringObj(varPtr[varIndex], string, size); } else { - SetVarToObj(varPtr, varIndex, Tcl_NewStringObj(string, length)); + SetVarToObj(varPtr, varIndex, Tcl_NewStringObj(string, size)); } Tcl_SetObjResult(interp, varPtr[varIndex]); break; @@ -1357,18 +1358,18 @@ TeststringobjCmd( SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex])); } - string = Tcl_GetStringFromObj(varPtr[varIndex], &length); + string = Tcl_GetStringFromObj(varPtr[varIndex], &size); if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) { return TCL_ERROR; } - if ((i < 0) || (i > length)) { + if ((i < 0) || ((size_t)i > size)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "index value out of range", -1)); return TCL_ERROR; } - Tcl_AppendToObj(varPtr[varIndex], string + i, length - i); + Tcl_AppendToObj(varPtr[varIndex], string + i, size - i); Tcl_SetObjResult(interp, varPtr[varIndex]); break; case 11: /* appendself2 */ @@ -1388,18 +1389,18 @@ TeststringobjCmd( SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex])); } - unicode = Tcl_GetUnicodeFromObj(varPtr[varIndex], &length); + unicode = Tcl_GetUnicodeFromObj(varPtr[varIndex], &size); if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) { return TCL_ERROR; } - if ((i < 0) || (i > length)) { + if ((i < 0) || ((size_t)i > size)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "index value out of range", -1)); return TCL_ERROR; } - TclAppendUnicodeToObj(varPtr[varIndex], unicode + i, length - i); + TclAppendUnicodeToObj(varPtr[varIndex], unicode + i, size - i); Tcl_SetObjResult(interp, varPtr[varIndex]); break; } diff --git a/generic/tclTimer.c b/generic/tclTimer.c index ede233a..eff2f8a 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -893,10 +893,10 @@ Tcl_AfterObjCmd( } else { commandPtr = Tcl_ConcatObj(objc-2, objv+2); } - command = TclGetStringFromObj(commandPtr, &length); + command = Tcl_GetStringFromObj(commandPtr, &length); for (afterPtr = assocPtr->firstAfterPtr; afterPtr != NULL; afterPtr = afterPtr->nextPtr) { - tempCommand = TclGetStringFromObj(afterPtr->commandPtr, + tempCommand = Tcl_GetStringFromObj(afterPtr->commandPtr, &tempLength); if ((length == tempLength) && !memcmp(command, tempCommand, length)) { diff --git a/generic/tclTrace.c b/generic/tclTrace.c index a34ad31..39ead67 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -279,7 +279,7 @@ Tcl_TraceObjCmd( TclNewObj(opsList); Tcl_IncrRefCount(opsList); - flagOps = TclGetStringFromObj(objv[3], &numFlags); + flagOps = Tcl_GetStringFromObj(objv[3], &numFlags); if (numFlags == 0) { Tcl_DecrRefCount(opsList); goto badVarOps; @@ -465,7 +465,7 @@ TraceExecutionObjCmd( break; } } - command = TclGetStringFromObj(objv[5], &commandLength); + command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)Tcl_Alloc( @@ -702,7 +702,7 @@ TraceCommandObjCmd( } } - command = TclGetStringFromObj(objv[5], &commandLength); + command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)Tcl_Alloc( @@ -905,7 +905,7 @@ TraceVariableObjCmd( break; } } - command = TclGetStringFromObj(objv[5], &commandLength); + command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { CombinedTraceVarInfo *ctvarPtr = (CombinedTraceVarInfo *)Tcl_Alloc( diff --git a/generic/tclUtil.c b/generic/tclUtil.c index cb2bd71..fe914ba 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1956,7 +1956,7 @@ Tcl_ConcatObj( if (TclListObjIsCanonical(objPtr)) { continue; } - (void)TclGetStringFromObj(objPtr, &length); + (void)Tcl_GetStringFromObj(objPtr, &length); if (length > 0) { break; } @@ -1993,7 +1993,7 @@ Tcl_ConcatObj( */ for (i = 0; i < objc; i++) { - element = TclGetStringFromObj(objv[i], &elemLength); + element = Tcl_GetStringFromObj(objv[i], &elemLength); bytesNeeded += elemLength; } @@ -2010,7 +2010,7 @@ Tcl_ConcatObj( for (i = 0; i < objc; i++) { size_t triml, trimr; - element = TclGetStringFromObj(objv[i], &elemLength); + element = Tcl_GetStringFromObj(objv[i], &elemLength); /* Trim away the leading/trailing whitespace. */ triml = TclTrim(element, elemLength, CONCAT_TRIM_SET, @@ -2493,15 +2493,15 @@ TclStringMatchObj( if (TclHasIntRep(strObj, &tclStringType) || (strObj->typePtr == NULL)) { Tcl_UniChar *udata, *uptn; - udata = TclGetUnicodeFromObj(strObj, &length); - uptn = TclGetUnicodeFromObj(ptnObj, &plen); + udata = Tcl_GetUnicodeFromObj(strObj, &length); + uptn = Tcl_GetUnicodeFromObj(ptnObj, &plen); match = TclUniCharMatch(udata, length, uptn, plen, flags); } else if (TclIsPureByteArray(strObj) && TclIsPureByteArray(ptnObj) && !flags) { unsigned char *data, *ptn; - data = TclGetByteArrayFromObj(strObj, &length); - ptn = TclGetByteArrayFromObj(ptnObj, &plen); + data = Tcl_GetByteArrayFromObj(strObj, &length); + ptn = Tcl_GetByteArrayFromObj(ptnObj, &plen); match = TclByteArrayMatch(data, length, ptn, plen, 0); } else { match = Tcl_StringCaseMatch(TclGetString(strObj), @@ -2629,7 +2629,7 @@ TclDStringAppendObj( Tcl_Obj *objPtr) { size_t length; - const char *bytes = TclGetStringFromObj(objPtr, &length); + const char *bytes = Tcl_GetStringFromObj(objPtr, &length); return Tcl_DStringAppend(dsPtr, bytes, length); } @@ -3452,7 +3452,7 @@ GetEndOffsetFromObj( while ((irPtr = TclFetchIntRep(objPtr, &endOffsetType)) == NULL) { Tcl_ObjIntRep ir; size_t length; - const char *bytes = TclGetStringFromObj(objPtr, &length); + const char *bytes = Tcl_GetStringFromObj(objPtr, &length); if (*bytes != 'e') { int numType; diff --git a/generic/tclVar.c b/generic/tclVar.c index c21ba2f..b3aee51 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -665,7 +665,7 @@ TclObjLookupVarEx( */ size_t len; - const char *part1 = TclGetStringFromObj(part1Ptr, &len); + const char *part1 = Tcl_GetStringFromObj(part1Ptr, &len); if ((len > 1) && (part1[len - 1] == ')')) { const char *part2 = strchr(part1, '('); @@ -848,7 +848,7 @@ TclLookupSimpleVar( ResolverScheme *resPtr; int isNew, i, result; size_t varLen; - const char *varName = TclGetStringFromObj(varNamePtr, &varLen); + const char *varName = Tcl_GetStringFromObj(varNamePtr, &varLen); varPtr = NULL; varNsPtr = NULL; /* Set non-NULL if a nonlocal variable. */ @@ -983,7 +983,7 @@ TclLookupSimpleVar( Tcl_Obj *objPtr = *objPtrPtr; if (objPtr) { - localNameStr = TclGetStringFromObj(objPtr, &localLen); + localNameStr = Tcl_GetStringFromObj(objPtr, &localLen); if ((varLen == localLen) && (varName[0] == localNameStr[0]) && !memcmp(varName, localNameStr, varLen)) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f0c8ce9..a830cd0 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -228,7 +228,7 @@ typedef struct ZipFile { typedef struct ZipEntry { char *name; /* The full pathname of the virtual file */ ZipFile *zipFilePtr; /* The ZIP file holding this virtual file */ - long long offset; /* Data offset into memory mapped ZIP file */ + size_t offset; /* Data offset into memory mapped ZIP file */ int numBytes; /* Uncompressed size of the virtual file */ int numCompressedBytes; /* Compressed size of the virtual file */ int compressMethod; /* Compress method */ @@ -3035,7 +3035,7 @@ ZipFSListObjCmd( } if (objc == 3) { size_t n; - char *what = TclGetStringFromObj(objv[1], &n); + char *what = Tcl_GetStringFromObj(objv[1], &n); if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { pattern = TclGetString(objv[2]); @@ -3884,7 +3884,7 @@ ZipChannelOpen( } wrapchan: - sprintf(cname, "zipfs_%" TCL_LL_MODIFIER "x_%d", z->offset, + sprintf(cname, "zipfs_%" TCL_Z_MODIFIER "x_%d", z->offset, ZipFS.idCount++); z->zipFilePtr->numOpen++; Unlock(); @@ -4130,13 +4130,13 @@ ZipFSMatchInDirectoryProc( * The prefix that gets prepended to results. */ - prefix = TclGetStringFromObj(pathPtr, &prefixLen); + prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); /* * The (normalized) path we're searching. */ - path = TclGetStringFromObj(normPathPtr, &len); + path = Tcl_GetStringFromObj(normPathPtr, &len); Tcl_DStringInit(&dsPref); Tcl_DStringAppend(&dsPref, prefix, prefixLen); @@ -4308,7 +4308,7 @@ ZipFSPathInFilesystemProc( return -1; } - path = TclGetStringFromObj(pathPtr, &len); + path = Tcl_GetStringFromObj(pathPtr, &len); if (strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) != 0) { return -1; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index d5d0c43..da45b2e 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -443,7 +443,7 @@ GenerateHeader( if (GetValue(interp, dictObj, "comment", &value) != TCL_OK) { goto error; } else if (value != NULL) { - valueStr = TclGetStringFromObj(value, &length); + valueStr = Tcl_GetStringFromObj(value, &length); Tcl_UtfToExternal(NULL, latin1enc, valueStr, length, 0, NULL, headerPtr->nativeCommentBuf, MAX_COMMENT_LEN-1, NULL, &len, NULL); @@ -464,7 +464,7 @@ GenerateHeader( if (GetValue(interp, dictObj, "filename", &value) != TCL_OK) { goto error; } else if (value != NULL) { - valueStr = TclGetStringFromObj(value, &length); + valueStr = Tcl_GetStringFromObj(value, &length); Tcl_UtfToExternal(NULL, latin1enc, valueStr, length, 0, NULL, headerPtr->nativeFilenameBuf, MAXPATHLEN-1, NULL, &len, NULL); headerPtr->nativeFilenameBuf[len] = '\0'; @@ -595,7 +595,7 @@ SetInflateDictionary( { if (compDictObj != NULL) { size_t length = 0; - unsigned char *bytes = TclGetByteArrayFromObj(compDictObj, &length); + unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length); return inflateSetDictionary(strm, bytes, length); } @@ -609,7 +609,7 @@ SetDeflateDictionary( { if (compDictObj != NULL) { size_t length = 0; - unsigned char *bytes = TclGetByteArrayFromObj(compDictObj, &length); + unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length); return deflateSetDictionary(strm, bytes, length); } @@ -1386,7 +1386,7 @@ Tcl_ZlibStreamGet( if (Tcl_IsShared(itemObj)) { itemObj = Tcl_DuplicateObj(itemObj); } - itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen); + itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen); Tcl_IncrRefCount(itemObj); zshPtr->currentInput = itemObj; zshPtr->stream.next_in = itemPtr; @@ -1458,7 +1458,7 @@ Tcl_ZlibStreamGet( if (Tcl_IsShared(itemObj)) { itemObj = Tcl_DuplicateObj(itemObj); } - itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen); + itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen); Tcl_IncrRefCount(itemObj); zshPtr->currentInput = itemObj; zshPtr->stream.next_in = itemPtr; @@ -1507,7 +1507,7 @@ Tcl_ZlibStreamGet( count = 0; for (i=0; i<listLen; i++) { Tcl_ListObjIndex(NULL, zshPtr->outData, i, &itemObj); - (void) TclGetByteArrayFromObj(itemObj, &itemLen); + (void) Tcl_GetByteArrayFromObj(itemObj, &itemLen); if (i == 0) { count += itemLen - zshPtr->outPos; } else { @@ -1532,7 +1532,7 @@ Tcl_ZlibStreamGet( */ Tcl_ListObjIndex(NULL, zshPtr->outData, 0, &itemObj); - itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen); + itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen); if (itemLen-zshPtr->outPos + dataPos >= count) { size_t len = count - dataPos; @@ -3481,7 +3481,7 @@ ZlibTransformGetOption( } else { if (cd->compDictObj) { size_t length; - const char *str = TclGetStringFromObj(cd->compDictObj, &length); + const char *str = Tcl_GetStringFromObj(cd->compDictObj, &length); Tcl_DStringAppend(dsPtr, str, length); } @@ -3721,7 +3721,7 @@ ZlibStackChannelTransform( if (compDictObj != NULL) { cd->compDictObj = Tcl_DuplicateObj(compDictObj); Tcl_IncrRefCount(cd->compDictObj); - Tcl_GetByteArrayFromObj(cd->compDictObj, NULL); + TclGetByteArrayFromObj(cd->compDictObj, NULL); } if (format == TCL_ZLIB_FORMAT_RAW) { diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index d408218..b1961e9 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -641,7 +641,7 @@ SetOSTypeFromAny( Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); size_t length; - string = TclGetStringFromObj(objPtr, &length); + string = Tcl_GetStringFromObj(objPtr, &length); Tcl_UtfToExternalDString(encoding, string, length, &ds); if (Tcl_DStringLength(&ds) > 4) { diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index e402fde..adcbabb 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1506,7 +1506,7 @@ SetGroupAttribute( const char *string; size_t length; - string = TclGetStringFromObj(attributePtr, &length); + string = Tcl_GetStringFromObj(attributePtr, &length); native = Tcl_UtfToExternalDString(NULL, string, length, &ds); groupPtr = TclpGetGrNam(native); /* INTL: Native. */ @@ -1573,7 +1573,7 @@ SetOwnerAttribute( const char *string; size_t length; - string = TclGetStringFromObj(attributePtr, &length); + string = Tcl_GetStringFromObj(attributePtr, &length); native = Tcl_UtfToExternalDString(NULL, string, length, &ds); pwPtr = TclpGetPwNam(native); /* INTL: Native. */ @@ -1948,7 +1948,7 @@ TclpObjNormalizePath( const char *currentPathEndPosition; char cur; size_t pathLen; - const char *path = TclGetStringFromObj(pathPtr, &pathLen); + const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen); Tcl_DString ds; const char *nativePath; #ifndef NO_REALPATH @@ -2178,7 +2178,7 @@ TclUnixOpenTemporaryFile( */ if (dirObj) { - string = TclGetStringFromObj(dirObj, &length); + string = Tcl_GetStringFromObj(dirObj, &length); Tcl_UtfToExternalDString(NULL, string, length, &templ); } else { Tcl_DStringInit(&templ); @@ -2188,7 +2188,7 @@ TclUnixOpenTemporaryFile( TclDStringAppendLiteral(&templ, "/"); if (basenameObj) { - string = TclGetStringFromObj(basenameObj, &length); + string = Tcl_GetStringFromObj(basenameObj, &length); Tcl_UtfToExternalDString(NULL, string, length, &tmp); TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); @@ -2200,7 +2200,7 @@ TclUnixOpenTemporaryFile( #ifdef HAVE_MKSTEMPS if (extensionObj) { - string = TclGetStringFromObj(extensionObj, &length); + string = Tcl_GetStringFromObj(extensionObj, &length); Tcl_UtfToExternalDString(NULL, string, length, &tmp); TclDStringAppendDString(&templ, &tmp); fd = mkstemps(Tcl_DStringValue(&templ), Tcl_DStringLength(&tmp)); diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 4c4d639..3c8a318 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -961,7 +961,7 @@ TclpObjLink( if (transPtr == NULL) { return NULL; } - target = TclGetStringFromObj(transPtr, &length); + target = Tcl_GetStringFromObj(transPtr, &length); target = Tcl_UtfToExternalDString(NULL, target, length, &ds); Tcl_DecrRefCount(transPtr); @@ -1115,7 +1115,7 @@ TclNativeCreateNativeRep( Tcl_IncrRefCount(validPathPtr); } - str = TclGetStringFromObj(validPathPtr, &len); + str = Tcl_GetStringFromObj(validPathPtr, &len); Tcl_UtfToExternalDString(NULL, str, len, &ds); len = Tcl_DStringLength(&ds) + sizeof(char); if (strlen(Tcl_DStringValue(&ds)) < len - sizeof(char)) { diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index ed03f69..f8bca0f 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -544,7 +544,7 @@ TclpInitLibraryPath( Tcl_DStringFree(&buffer); *encodingPtr = Tcl_GetEncoding(NULL, NULL); - str = TclGetStringFromObj(pathPtr, lengthPtr); + str = Tcl_GetStringFromObj(pathPtr, lengthPtr); *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1); memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index da6ee2c..5d3d16d 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1536,7 +1536,7 @@ GetWinFileAttributes( */ size_t len; - const char *str = TclGetStringFromObj(fileName, &len); + const char *str = Tcl_GetStringFromObj(fileName, &len); if (len < 4) { if (len == 0) { @@ -1625,7 +1625,7 @@ ConvertFileNameFormat( Tcl_ListObjIndex(NULL, splitPath, i, &elt); - pathv = TclGetStringFromObj(elt, &length); + pathv = Tcl_GetStringFromObj(elt, &length); if ((pathv[0] == '/') || ((length == 3) && (pathv[1] == ':')) || (strcmp(pathv, ".") == 0) || (strcmp(pathv, "..") == 0)) { /* @@ -1661,7 +1661,7 @@ ConvertFileNameFormat( * likely to lead to infinite loops. */ - tempString = TclGetStringFromObj(tempPath, &length); + tempString = Tcl_GetStringFromObj(tempPath, &length); Tcl_DStringInit(&ds); nativeName = Tcl_UtfToWCharDString(tempString, length, &ds); Tcl_DecrRefCount(tempPath); diff --git a/win/tclWinFile.c b/win/tclWinFile.c index fbd49dc..f954516 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -922,7 +922,7 @@ TclpMatchInDirectory( DWORD attr; WIN32_FILE_ATTRIBUTE_DATA data; size_t length = 0; - const char *str = TclGetStringFromObj(norm, &length); + const char *str = Tcl_GetStringFromObj(norm, &length); native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr); @@ -982,7 +982,7 @@ TclpMatchInDirectory( */ Tcl_DStringInit(&dsOrig); - dirName = TclGetStringFromObj(fileNamePtr, &dirLength); + dirName = Tcl_GetStringFromObj(fileNamePtr, &dirLength); Tcl_DStringAppend(&dsOrig, dirName, dirLength); lastChar = dirName[dirLength -1]; @@ -2808,7 +2808,7 @@ TclpObjNormalizePath( tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), nextCheckpoint); Tcl_AppendToObj(tmpPathPtr, lastValidPathEnd, -1); - path = TclGetStringFromObj(tmpPathPtr, &length); + path = Tcl_GetStringFromObj(tmpPathPtr, &length); Tcl_SetStringObj(pathPtr, path, length); Tcl_DecrRefCount(tmpPathPtr); } else { @@ -2893,7 +2893,7 @@ TclWinVolumeRelativeNormalize( */ size_t cwdLen; - const char *drive = TclGetStringFromObj(useThisCwd, &cwdLen); + const char *drive = Tcl_GetStringFromObj(useThisCwd, &cwdLen); char drive_cur = path[0]; if (drive_cur >= 'a') { @@ -3066,7 +3066,7 @@ TclNativeCreateNativeRep( Tcl_IncrRefCount(validPathPtr); } - str = TclGetStringFromObj(validPathPtr, &len); + str = Tcl_GetStringFromObj(validPathPtr, &len); if (strlen(str) != len) { /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index e67e0cb..7205498 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -209,7 +209,7 @@ TclpInitLibraryPath( TclGetProcessGlobalValue(&sourceLibraryDir)); *encodingPtr = NULL; - bytes = TclGetStringFromObj(pathPtr, &length); + bytes = Tcl_GetStringFromObj(pathPtr, &length); *lengthPtr = length++; *valuePtr = (char *)Tcl_Alloc(length); memcpy(*valuePtr, bytes, length); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 5971b81..60e421d 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3212,7 +3212,7 @@ TclpOpenTemporaryFile( } namePtr += length * sizeof(WCHAR); if (basenameObj) { - const char *string = TclGetStringFromObj(basenameObj, &length); + const char *string = Tcl_GetStringFromObj(basenameObj, &length); Tcl_DStringInit(&buf); Tcl_UtfToWCharDString(string, length, &buf); |