diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-17 14:12:55 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-17 14:12:55 (GMT) |
commit | be275081a1ef4cf0490a07d2e253ca901d932fe8 (patch) | |
tree | 6bd1b9d196a5924bc9e00578719d36ef22f2eafd /generic | |
parent | 0a36b1187dcef39b41d28a5ce319aa7c54f56f66 (diff) | |
parent | 733b7a43a45ee6be75ccd99172f66b35b69841c5 (diff) | |
download | tcl-be275081a1ef4cf0490a07d2e253ca901d932fe8.zip tcl-be275081a1ef4cf0490a07d2e253ca901d932fe8.tar.gz tcl-be275081a1ef4cf0490a07d2e253ca901d932fe8.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
47 files changed, 259 insertions, 222 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 0d19543..81d06cc 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -2096,8 +2096,9 @@ GetNextOperand( * with \-substitutions done. */ { Tcl_Interp* interp = (Tcl_Interp*) assemEnvPtr->envPtr->iPtr; - Tcl_Obj* operandObj = Tcl_NewObj(); + Tcl_Obj* operandObj; + TclNewObj(operandObj); if (!TclWordKnownAtCompileTime(*tokenPtrPtr, operandObj)) { Tcl_DecrRefCount(operandObj); if (assemEnvPtr->flags & TCL_EVAL_DIRECT) { diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 18cb2f1..3d12e24 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1162,7 +1162,7 @@ BinaryFormatCmd( * bytes and filling with nulls. */ - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); buffer = Tcl_SetByteArrayLength(resultPtr, length); memset(buffer, 0, length); @@ -1595,7 +1595,7 @@ BinaryScanCmd( } } src = buffer + offset; - valuePtr = Tcl_NewObj(); + TclNewObj(valuePtr); Tcl_SetObjLength(valuePtr, count); dest = TclGetString(valuePtr); @@ -1650,7 +1650,7 @@ BinaryScanCmd( } } src = buffer + offset; - valuePtr = Tcl_NewObj(); + TclNewObj(valuePtr); Tcl_SetObjLength(valuePtr, count); dest = TclGetString(valuePtr); @@ -1734,7 +1734,7 @@ BinaryScanCmd( if ((length - offset) < (count * size)) { goto done; } - valuePtr = Tcl_NewObj(); + TclNewObj(valuePtr); src = buffer + offset; for (i = 0; (size_t)i < count; i++) { elementPtr = ScanNumber(src, cmd, flags, &numberCachePtr); @@ -2376,8 +2376,9 @@ ScanNumber( return (Tcl_Obj *)Tcl_GetHashValue(hPtr); } if (tablePtr->numEntries <= BINARY_SCAN_MAX_CACHE) { - Tcl_Obj *objPtr = Tcl_NewWideIntObj(value); + Tcl_Obj *objPtr; + TclNewIntObj(objPtr, value); Tcl_IncrRefCount(objPtr); Tcl_SetHashValue(hPtr, objPtr); return objPtr; @@ -2763,7 +2764,7 @@ BinaryEncode64( maxlen = 0; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); data = TclGetByteArrayFromObj(objv[objc - 1], &count); if (count > 0) { unsigned char *cursor = NULL; @@ -2915,7 +2916,7 @@ BinaryEncodeUu( * enough". */ - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); offset = 0; data = TclGetByteArrayFromObj(objv[objc - 1], &count); rawLength = (lineLength - 1) * 3 / 4; diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 3255e00..7412e2f 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -298,7 +298,7 @@ TclCompileArraySetCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); dataTokenPtr = TokenAfter(varTokenPtr); - literalObj = Tcl_NewObj(); + TclNewObj(literalObj); isDataLiteral = TclWordKnownAtCompileTime(dataTokenPtr, literalObj); isDataValid = (isDataLiteral && Tcl_ListObjLength(NULL, literalObj, &len) == TCL_OK); @@ -875,10 +875,10 @@ TclCompileConcatCmd( * implement with a simple push. */ - listObj = Tcl_NewObj(); + TclNewObj(listObj); for (i = 1, tokenPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++) { tokenPtr = TokenAfter(tokenPtr); - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) { Tcl_DecrRefCount(objPtr); Tcl_DecrRefCount(listObj); @@ -1304,10 +1304,10 @@ TclCompileDictCreateCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - dictObj = Tcl_NewObj(); + TclNewObj(dictObj); Tcl_IncrRefCount(dictObj); for (i=1 ; i<parsePtr->numWords ; i+=2) { - keyObj = Tcl_NewObj(); + TclNewObj(keyObj); Tcl_IncrRefCount(keyObj); if (!TclWordKnownAtCompileTime(tokenPtr, keyObj)) { Tcl_DecrRefCount(keyObj); @@ -1315,7 +1315,7 @@ TclCompileDictCreateCmd( goto nonConstant; } tokenPtr = TokenAfter(tokenPtr); - valueObj = Tcl_NewObj(); + TclNewObj(valueObj); Tcl_IncrRefCount(valueObj); if (!TclWordKnownAtCompileTime(tokenPtr, valueObj)) { Tcl_DecrRefCount(keyObj); @@ -2314,11 +2314,12 @@ DisassembleDictUpdateInfo( { DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData; size_t i; - Tcl_Obj *variables = Tcl_NewObj(); + Tcl_Obj *variables; + TclNewObj(variables); for (i=0 ; i<duiPtr->length ; i++) { Tcl_ListObjAppendElement(NULL, variables, - Tcl_NewIntObj(duiPtr->varIndices[i])); + Tcl_NewWideIntObj(duiPtr->varIndices[i])); } Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", -1), variables); @@ -2734,7 +2735,7 @@ CompileEachloopCmd( * a scalar, or if any var list needs substitutions. */ - varListObj = Tcl_NewObj(); + TclNewObj(varListObj); for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { @@ -3055,10 +3056,10 @@ DisassembleForeachInfo( * Data stores. */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); for (i=0 ; i<infoPtr->numLists ; i++) { Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(infoPtr->firstValueTemp + i)); + Tcl_NewWideIntObj(infoPtr->firstValueTemp + i)); } Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("data", -1), objPtr); @@ -3067,19 +3068,19 @@ DisassembleForeachInfo( */ Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("loop", -1), - Tcl_NewIntObj(infoPtr->loopCtTemp)); + Tcl_NewWideIntObj(infoPtr->loopCtTemp)); /* * Assignment targets. */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); for (i=0 ; i<infoPtr->numLists ; i++) { - innerPtr = Tcl_NewObj(); + TclNewObj(innerPtr); varsPtr = infoPtr->varLists[i]; for (j=0 ; j<varsPtr->numVars ; j++) { Tcl_ListObjAppendElement(NULL, innerPtr, - Tcl_NewIntObj(varsPtr->varIndexes[j])); + Tcl_NewWideIntObj(varsPtr->varIndexes[j])); } Tcl_ListObjAppendElement(NULL, objPtr, innerPtr); } @@ -3103,19 +3104,19 @@ DisassembleNewForeachInfo( */ Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("jumpOffset", -1), - Tcl_NewIntObj(infoPtr->loopCtTemp)); + Tcl_NewWideIntObj(infoPtr->loopCtTemp)); /* * Assignment targets. */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); for (i=0 ; i<infoPtr->numLists ; i++) { - innerPtr = Tcl_NewObj(); + TclNewObj(innerPtr); varsPtr = infoPtr->varLists[i]; for (j=0 ; j<varsPtr->numVars ; j++) { Tcl_ListObjAppendElement(NULL, innerPtr, - Tcl_NewIntObj(varsPtr->varIndexes[j])); + Tcl_NewWideIntObj(varsPtr->varIndexes[j])); } Tcl_ListObjAppendElement(NULL, objPtr, innerPtr); } @@ -3169,7 +3170,7 @@ TclCompileFormatCmd( * a case we can handle by compiling to a constant. */ - formatObj = Tcl_NewObj(); + TclNewObj(formatObj); Tcl_IncrRefCount(formatObj); tokenPtr = TokenAfter(tokenPtr); if (!TclWordKnownAtCompileTime(tokenPtr, formatObj)) { @@ -3180,7 +3181,7 @@ TclCompileFormatCmd( objv = (Tcl_Obj **)Tcl_Alloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *)); for (i=0 ; i+2 < parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); - objv[i] = Tcl_NewObj(); + TclNewObj(objv[i]); Tcl_IncrRefCount(objv[i]); if (!TclWordKnownAtCompileTime(tokenPtr, objv[i])) { goto checkForStringConcatCase; @@ -3272,7 +3273,7 @@ TclCompileFormatCmd( start = TclGetString(formatObj); /* The start of the currently-scanned literal * in the format string. */ - tmpObj = Tcl_NewObj(); /* The buffer used to accumulate the literal + TclNewObj(tmpObj); /* The buffer used to accumulate the literal * being built. */ for (bytes = start ; *bytes ; bytes++) { if (*bytes == '%') { @@ -3290,7 +3291,7 @@ TclCompileFormatCmd( if (len > 0) { PushLiteral(envPtr, b, len); Tcl_DecrRefCount(tmpObj); - tmpObj = Tcl_NewObj(); + TclNewObj(tmpObj); i++; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index b0afef8..1f04d02 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -53,9 +53,10 @@ TclGetIndexFromToken( size_t after, int *indexPtr) { - Tcl_Obj *tmpObj = Tcl_NewObj(); + Tcl_Obj *tmpObj; int result = TCL_ERROR; + TclNewObj(tmpObj); if (TclWordKnownAtCompileTime(tokenPtr, tmpObj)) { result = TclIndexEncode(NULL, tmpObj, before, after, indexPtr); } @@ -599,7 +600,7 @@ TclCompileInfoCommandsCmd( return TCL_ERROR; } tokenPtr = TokenAfter(parsePtr->tokenPtr); - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) { goto notCompilable; @@ -1170,9 +1171,9 @@ TclCompileListCmd( numWords = parsePtr->numWords; valueTokenPtr = TokenAfter(parsePtr->tokenPtr); - listObj = Tcl_NewObj(); + TclNewObj(listObj); for (i = 1; i < numWords && listObj != NULL; i++) { - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); if (TclWordKnownAtCompileTime(valueTokenPtr, objPtr)) { (void) Tcl_ListObjAppendElement(NULL, listObj, objPtr); } else { @@ -2267,7 +2268,7 @@ TclCompileRegsubCmd( Tcl_DStringInit(&pattern); tokenPtr = TokenAfter(tokenPtr); - patternObj = Tcl_NewObj(); + TclNewObj(patternObj); if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { goto done; } @@ -2278,7 +2279,7 @@ TclCompileRegsubCmd( } tokenPtr = TokenAfter(tokenPtr); Tcl_DecrRefCount(patternObj); - patternObj = Tcl_NewObj(); + TclNewObj(patternObj); if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { goto done; } @@ -2293,7 +2294,7 @@ TclCompileRegsubCmd( stringTokenPtr = TokenAfter(tokenPtr); tokenPtr = TokenAfter(stringTokenPtr); - replacementObj = Tcl_NewObj(); + TclNewObj(replacementObj); if (!TclWordKnownAtCompileTime(tokenPtr, replacementObj)) { goto done; } @@ -2443,7 +2444,7 @@ TclCompileReturnCmd( */ for (objc = 0; objc < numOptionWords; objc++) { - objv[objc] = Tcl_NewObj(); + TclNewObj(objv[objc]); Tcl_IncrRefCount(objv[objc]); if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) { /* @@ -2662,7 +2663,7 @@ TclCompileUpvarCmd( * Push the frame index if it is known at compile time */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); tokenPtr = TokenAfter(parsePtr->tokenPtr); if (TclWordKnownAtCompileTime(tokenPtr, objPtr)) { CallFrame *framePtr; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 27f3bd1..c9f72dd 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -241,7 +241,7 @@ TclCompileStringCatCmd( folded = NULL; wordTokenPtr = TokenAfter(parsePtr->tokenPtr); for (i = 1; i < numWords; i++) { - obj = Tcl_NewObj(); + TclNewObj(obj); if (TclWordKnownAtCompileTime(wordTokenPtr, obj)) { if (folded) { Tcl_AppendObjToObj(folded, obj); @@ -526,7 +526,7 @@ TclCompileStringIsCmd( if (parsePtr->numWords < 3 || parsePtr->numWords > 6) { return TCL_ERROR; } - isClass = Tcl_NewObj(); + TclNewObj(isClass); if (!TclWordKnownAtCompileTime(tokenPtr, isClass)) { Tcl_DecrRefCount(isClass); return TCL_ERROR; @@ -932,7 +932,7 @@ TclCompileStringMapCmd( } mapTokenPtr = TokenAfter(parsePtr->tokenPtr); stringTokenPtr = TokenAfter(mapTokenPtr); - mapObj = Tcl_NewObj(); + TclNewObj(mapObj); Tcl_IncrRefCount(mapObj); if (!TclWordKnownAtCompileTime(mapTokenPtr, mapObj)) { Tcl_DecrRefCount(mapObj); @@ -1463,7 +1463,7 @@ TclCompileSubstCmd( objv = (Tcl_Obj **)TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *)); for (objc = 0; objc < /*numArgs*/ numOpts; objc++) { - objv[objc] = Tcl_NewObj(); + TclNewObj(objv[objc]); Tcl_IncrRefCount(objv[objc]); if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) { objc++; @@ -2614,18 +2614,19 @@ DisassembleJumptableInfo( TCL_UNUSED(unsigned int)) { JumptableInfo *jtPtr = (JumptableInfo *)clientData; - Tcl_Obj *mapping = Tcl_NewObj(); + Tcl_Obj *mapping; Tcl_HashEntry *hPtr; Tcl_HashSearch search; const char *keyPtr; - int offset; + size_t offset; + TclNewObj(mapping); hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search); for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) { keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr); offset = PTR2INT(Tcl_GetHashValue(hPtr)); Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1), - Tcl_NewIntObj(offset)); + Tcl_NewWideIntObj(offset)); } Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("mapping", -1), mapping); } @@ -3629,8 +3630,9 @@ TclCompileUnsetCmd( */ for (i=1,varTokenPtr=parsePtr->tokenPtr ; i<parsePtr->numWords ; i++) { - Tcl_Obj *leadingWord = Tcl_NewObj(); + Tcl_Obj *leadingWord; + TclNewObj(leadingWord); varTokenPtr = TokenAfter(varTokenPtr); if (!TclWordKnownAtCompileTime(varTokenPtr, leadingWord)) { TclDecrRefCount(leadingWord); diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index b37faef..dc10e4b 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1836,11 +1836,13 @@ Tcl_ParseExpr( { int code; OpNode *opTree = NULL; /* Will point to the tree of operators. */ - Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals. */ - Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names. */ + Tcl_Obj *litList; /* List to hold the literals. */ + Tcl_Obj *funcList; /* List to hold the functon names. */ Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions. */ + TclNewObj(litList); + TclNewObj(funcList); if (numBytes == TCL_INDEX_NONE) { numBytes = (start ? strlen(start) : 0); } @@ -2039,7 +2041,7 @@ ParseLexeme( break; } - literal = Tcl_NewObj(); + TclNewObj(literal); if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end, TCL_PARSE_NO_WHITESPACE) == TCL_OK) { if (end < start + numBytes && !TclIsBareword(*end)) { @@ -2154,12 +2156,15 @@ TclCompileExpr( int optimize) /* 0 for one-off expressions. */ { OpNode *opTree = NULL; /* Will point to the tree of operators */ - Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals */ - Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names*/ + Tcl_Obj *litList; /* List to hold the literals */ + Tcl_Obj *funcList; /* List to hold the functon names*/ Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions */ + int code; - int code = ParseExpr(interp, script, numBytes, &opTree, litList, + TclNewObj(litList); + TclNewObj(funcList); + code = ParseExpr(interp, script, numBytes, &opTree, litList, funcList, parsePtr, 0 /* parseOnly */); if (code == TCL_OK) { @@ -2711,7 +2716,7 @@ TclVariadicOpCmd( int code; if (objc < 2) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(occdPtr->i.identity)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(occdPtr->i.identity)); return TCL_OK; } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 55914c8..85f785f 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1727,7 +1727,7 @@ TclWordKnownAtCompileTime( } tokenPtr++; if (valuePtr != NULL) { - tempPtr = Tcl_NewObj(); + TclNewObj(tempPtr); Tcl_IncrRefCount(tempPtr); } while (numComponents--) { @@ -2017,7 +2017,7 @@ CompileCommandTokens( Interp *iPtr = (Interp *) interp; Tcl_Token *tokenPtr = parsePtr->tokenPtr; ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; - Tcl_Obj *cmdObj = Tcl_NewObj(); + Tcl_Obj *cmdObj; Command *cmdPtr = NULL; int code = TCL_ERROR; int cmdKnown, expand = -1; @@ -2032,6 +2032,7 @@ CompileCommandTokens( /* Pre-Compile */ + TclNewObj(cmdObj); envPtr->numCommands++; EnterCmdStartData(envPtr, cmdIdx, parsePtr->commandStart - envPtr->source, startCodeOffset); diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 9e7370f..9fc2fa9 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2028,7 +2028,7 @@ DictSizeCmd( } result = Tcl_DictObjSize(interp, objv[1], &size); if (result == TCL_OK) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(size)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(size)); } return result; } @@ -2203,7 +2203,7 @@ DictIncrCmd( Tcl_DictObjPut(NULL, dictPtr, objv[2], objv[3]); } } else { - Tcl_DictObjPut(NULL, dictPtr, objv[2], Tcl_NewIntObj(1)); + Tcl_DictObjPut(NULL, dictPtr, objv[2], Tcl_NewWideIntObj(1)); } } else { /* @@ -2217,7 +2217,7 @@ DictIncrCmd( if (objc == 4) { code = TclIncrObj(interp, valuePtr, objv[3]); } else { - Tcl_Obj *incrPtr = Tcl_NewIntObj(1); + Tcl_Obj *incrPtr = Tcl_NewWideIntObj(1); Tcl_IncrRefCount(incrPtr); code = TclIncrObj(interp, valuePtr, incrPtr); diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index f15e045..a96dba9 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -803,8 +803,9 @@ Tcl_Obj * TclNewInstNameObj( unsigned char inst) { - Tcl_Obj *objPtr = Tcl_NewObj(); + Tcl_Obj *objPtr; + TclNewObj(objPtr); TclInvalidateStringRep(objPtr); InstNameSetIntRep(objPtr, (long) inst); @@ -949,7 +950,7 @@ DisassembleByteCodeAsDicts( * Get the literals from the bytecode. */ - literals = Tcl_NewObj(); + TclNewObj(literals); for (i=0 ; i<codePtr->numLitObjects ; i++) { Tcl_ListObjAppendElement(NULL, literals, codePtr->objArrayPtr[i]); } @@ -958,7 +959,7 @@ DisassembleByteCodeAsDicts( * Get the variables from the bytecode. */ - variables = Tcl_NewObj(); + TclNewObj(variables); if (codePtr->procPtr) { int localCount = codePtr->procPtr->numCompiledLocals; CompiledLocal *localPtr = codePtr->procPtr->firstLocalPtr; @@ -966,7 +967,7 @@ DisassembleByteCodeAsDicts( for (i=0 ; i<localCount ; i++,localPtr=localPtr->nextPtr) { Tcl_Obj *descriptor[2]; - descriptor[0] = Tcl_NewObj(); + TclNewObj(descriptor[0]); if (!(localPtr->flags & (VAR_ARRAY|VAR_LINK))) { Tcl_ListObjAppendElement(NULL, descriptor[0], Tcl_NewStringObj("scalar", -1)); @@ -1006,12 +1007,12 @@ DisassembleByteCodeAsDicts( * Get the instructions from the bytecode. */ - instructions = Tcl_NewObj(); + TclNewObj(instructions); for (pc=codePtr->codeStart; pc<codePtr->codeStart+codePtr->numCodeBytes;){ const InstructionDesc *instDesc = &tclInstructionTable[*pc]; int address = pc - codePtr->codeStart; - inst = Tcl_NewObj(); + TclNewObj(inst); Tcl_ListObjAppendElement(NULL, inst, Tcl_NewStringObj( instDesc->name, -1)); opnd = pc + 1; @@ -1033,7 +1034,7 @@ DisassembleByteCodeAsDicts( val = TclGetUInt4AtPtr(opnd); opnd += 4; formatNumber: - Tcl_ListObjAppendElement(NULL, inst, Tcl_NewIntObj(val)); + Tcl_ListObjAppendElement(NULL, inst, Tcl_NewWideIntObj(val)); break; case OPERAND_OFFSET1: @@ -1101,7 +1102,7 @@ DisassembleByteCodeAsDicts( Tcl_Panic("opcode %d with more than zero 'no' operands", *pc); } } - Tcl_DictObjPut(NULL, instructions, Tcl_NewIntObj(address), inst); + Tcl_DictObjPut(NULL, instructions, Tcl_NewWideIntObj(address), inst); pc += instDesc->numBytes; } @@ -1109,21 +1110,23 @@ DisassembleByteCodeAsDicts( * Get the auxiliary data from the bytecode. */ - aux = Tcl_NewObj(); + TclNewObj(aux); for (i=0 ; i<codePtr->numAuxDataItems ; i++) { AuxData *auxData = &codePtr->auxDataArrayPtr[i]; Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, -1); if (auxData->type->disassembleProc) { - Tcl_Obj *desc = Tcl_NewObj(); + Tcl_Obj *desc; + TclNewObj(desc); Tcl_DictObjPut(NULL, desc, Tcl_NewStringObj("name", -1), auxDesc); auxDesc = desc; auxData->type->disassembleProc(auxData->clientData, auxDesc, codePtr, 0); } else if (auxData->type->printProc) { - Tcl_Obj *desc = Tcl_NewObj(); + Tcl_Obj *desc; + TclNewObj(desc); auxData->type->printProc(auxData->clientData, desc, codePtr, 0); Tcl_ListObjAppendElement(NULL, auxDesc, desc); } @@ -1134,7 +1137,7 @@ DisassembleByteCodeAsDicts( * Get the exception ranges from the bytecode. */ - exn = Tcl_NewObj(); + TclNewObj(exn); for (i=0 ; i<codePtr->numExceptRanges ; i++) { ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i]; @@ -1169,7 +1172,7 @@ DisassembleByteCodeAsDicts( ? ((ptr)+=5 , TclGetInt4AtPtr((ptr)-4)) \ : ((ptr)+=1 , TclGetInt1AtPtr((ptr)-1))) - commands = Tcl_NewObj(); + TclNewObj(commands); codeOffPtr = codePtr->codeDeltaStart; codeLenPtr = codePtr->codeLengthStart; srcOffPtr = codePtr->srcDeltaStart; @@ -1182,11 +1185,11 @@ DisassembleByteCodeAsDicts( codeLength = Decode(codeLenPtr); sourceOffset += Decode(srcOffPtr); sourceLength = Decode(srcLenPtr); - cmd = Tcl_NewObj(); + TclNewObj(cmd); Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codefrom", -1), - Tcl_NewIntObj(codeOffset)); + Tcl_NewWideIntObj(codeOffset)); Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", -1), - Tcl_NewIntObj(codeOffset + codeLength - 1)); + Tcl_NewWideIntObj(codeOffset + codeLength - 1)); /* * Convert byte offsets to character offsets; important if multibyte @@ -1217,7 +1220,7 @@ DisassembleByteCodeAsDicts( * Build the overall result. */ - description = Tcl_NewObj(); + TclNewObj(description); Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("literals", -1), literals); Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("variables", -1), @@ -1233,13 +1236,13 @@ DisassembleByteCodeAsDicts( Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("namespace", -1), Tcl_NewStringObj(codePtr->nsPtr->fullName, -1)); Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("stackdepth", -1), - Tcl_NewIntObj(codePtr->maxStackDepth)); + Tcl_NewWideIntObj(codePtr->maxStackDepth)); Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("exceptdepth", -1), - Tcl_NewIntObj(codePtr->maxExceptDepth)); + Tcl_NewWideIntObj(codePtr->maxExceptDepth)); if (line >= 0) { Tcl_DictObjPut(NULL, description, Tcl_NewStringObj("initiallinenumber", -1), - Tcl_NewIntObj(line)); + Tcl_NewWideIntObj(line)); } if (file) { Tcl_DictObjPut(NULL, description, diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 4a43599..3bbb360 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -469,12 +469,13 @@ FillEncodingFileMap(void) */ int j, numFiles; - Tcl_Obj *directory, *matchFileList = Tcl_NewObj(); + Tcl_Obj *directory, *matchFileList; Tcl_Obj **filev; Tcl_GlobTypeData readableFiles = { TCL_GLOB_TYPE_FILE, TCL_GLOB_PERM_R, NULL, NULL }; + TclNewObj(matchFileList); Tcl_ListObjIndex(NULL, searchPath, i, &directory); Tcl_IncrRefCount(directory); Tcl_IncrRefCount(matchFileList); @@ -851,10 +852,11 @@ Tcl_GetEncodingNames( Tcl_HashTable table; Tcl_HashSearch search; Tcl_HashEntry *hPtr; - Tcl_Obj *map, *name, *result = Tcl_NewObj(); + Tcl_Obj *map, *name, *result; Tcl_DictSearch mapSearch; int dummy, done = 0; + TclNewObj(result); Tcl_InitObjHashTable(&table); /* diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 02405f5..0d048ab 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2910,7 +2910,7 @@ TclCompileEnsemble( DefineLineInformation; Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); Tcl_Obj *mapObj, *subcmdObj, *targetCmdObj, *listObj, **elems; - Tcl_Obj *replaced = Tcl_NewObj(), *replacement; + Tcl_Obj *replaced, *replacement; Tcl_Command ensemble = (Tcl_Command) cmdPtr; Command *oldCmdPtr = cmdPtr, *newCmdPtr; int len, result, flags = 0, i, depth = 1, invokeAnyway = 0; @@ -2918,6 +2918,7 @@ TclCompileEnsemble( size_t numBytes; const char *word; + TclNewObj(replaced); Tcl_IncrRefCount(replaced); if (parsePtr->numWords < depth + 1) { goto failed; @@ -3422,7 +3423,7 @@ CompileToInvokedCommand( * the implementation. */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); bytes = TclGetStringFromObj(objPtr, &length); if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) { @@ -3461,8 +3462,9 @@ CompileBasicNArgCommand( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Obj *objPtr = Tcl_NewObj(); + Tcl_Obj *objPtr; + TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); TclCompileInvocation(interp, parsePtr->tokenPtr, objPtr, diff --git a/generic/tclExecute.c b/generic/tclExecute.c index e3512ef..40bb351 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4866,7 +4866,7 @@ TEBCresume( if (toIdx == TCL_INDEX_NONE) { emptyList: - objResultPtr = Tcl_NewObj(); + TclNewObj(objResultPtr); TRACE_APPEND(("\"%.30s\"", O2S(objResultPtr))); NEXT_INST_F(9, 1, 1); } @@ -5126,7 +5126,7 @@ TEBCresume( * practical use. */ if (ch == -1) { - objResultPtr = Tcl_NewObj(); + TclNewObj(objResultPtr); } else { slength = Tcl_UniCharToUtf(ch, buf); if ((ch >= 0xD800) && (slength < 3)) { @@ -6673,7 +6673,7 @@ TEBCresume( break; } if (valuePtr == NULL) { - Tcl_DictObjPut(NULL, dictPtr, OBJ_AT_TOS,Tcl_NewIntObj(opnd)); + Tcl_DictObjPut(NULL, dictPtr, OBJ_AT_TOS, Tcl_NewWideIntObj(opnd)); } else { TclNewIntObj(value2Ptr, opnd); Tcl_IncrRefCount(value2Ptr); @@ -9339,7 +9339,7 @@ EvalStatsCmd( #define Percent(a,b) ((a) * 100.0 / (b)) - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); numInstructions = 0.0; diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index da195fc..6d7f3cf 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -904,7 +904,7 @@ FileBasename( } } if (resultPtr == NULL) { - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); } Tcl_IncrRefCount(resultPtr); Tcl_DecrRefCount(splitPtr); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 14d456e..5b641a8 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -644,12 +644,13 @@ SplitUnixPath( { size_t length; const char *origPath = path, *elementStart; - Tcl_Obj *result = Tcl_NewObj(); + Tcl_Obj *result; /* * Deal with the root directory as a special case. */ + TclNewObj(result); if (*path == '/') { Tcl_Obj *rootElt; ++path; @@ -735,9 +736,10 @@ SplitWinPath( const char *p, *elementStart; Tcl_PathType type = TCL_PATH_ABSOLUTE; Tcl_DString buf; - Tcl_Obj *result = Tcl_NewObj(); + Tcl_Obj *result; Tcl_DStringInit(&buf); + TclNewObj(result); p = ExtractWinRoot(path, &buf, 0, &type); /* @@ -979,7 +981,7 @@ Tcl_JoinPath( { int i; size_t len; - Tcl_Obj *listObj = Tcl_NewObj(); + Tcl_Obj *listObj; Tcl_Obj *resultObj; const char *resultStr; @@ -987,6 +989,7 @@ Tcl_JoinPath( * Build the list of paths. */ + TclNewObj(listObj); for (i = 0; i < argc; i++) { Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewStringObj(argv[i], -1)); diff --git a/generic/tclIO.c b/generic/tclIO.c index 884bd83..d84d0c7 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10981,7 +10981,7 @@ FixLevelCode( if (0 == strcmp(TclGetString(lv[i]), "-level")) { if (newlevel >= 0) { lvn[j++] = lv[i]; - lvn[j++] = Tcl_NewIntObj(newlevel); + lvn[j++] = Tcl_NewWideIntObj(newlevel); newlevel = -1; lignore = 1; continue; @@ -10991,7 +10991,7 @@ FixLevelCode( } else if (0 == strcmp(TclGetString(lv[i]), "-code")) { if (newcode >= 0) { lvn[j++] = lv[i]; - lvn[j++] = Tcl_NewIntObj(newcode); + lvn[j++] = Tcl_NewWideIntObj(newcode); newcode = -1; cignore = 1; continue; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index d2f38ff..31134fe 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -301,7 +301,7 @@ Tcl_GetsObjCmd( } TclChannelPreserve(chan); - linePtr = Tcl_NewObj(); + TclNewObj(linePtr); lineLen = Tcl_GetsObj(chan, linePtr); if (lineLen < 0) { if (!Tcl_Eof(chan) && !Tcl_InputBlocked(chan)) { @@ -330,7 +330,7 @@ Tcl_GetsObjCmd( code = TCL_ERROR; goto done; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(lineLen)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(lineLen)); } else { Tcl_SetObjResult(interp, linePtr); } @@ -426,7 +426,7 @@ Tcl_ReadObjCmd( } } - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); Tcl_IncrRefCount(resultPtr); TclChannelPreserve(chan); charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0); @@ -948,7 +948,7 @@ Tcl_ExecObjCmd( return TCL_OK; } - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); if (Tcl_GetChannelHandle(chan, TCL_READABLE, NULL) == TCL_OK) { if (Tcl_ReadChars(chan, resultPtr, -1, 0) == TCL_IO_FAILURE) { /* @@ -1336,7 +1336,7 @@ AcceptCallbackProc( Tcl_ListObjAppendElement(NULL, objv[1], Tcl_NewStringObj( Tcl_GetChannelName(chan), -1)); Tcl_ListObjAppendElement(NULL, objv[1], Tcl_NewStringObj(address, -1)); - Tcl_ListObjAppendElement(NULL, objv[1], Tcl_NewIntObj(port)); + Tcl_ListObjAppendElement(NULL, objv[1], Tcl_NewWideIntObj(port)); script = Tcl_ConcatObj(2, objv); Tcl_IncrRefCount(script); @@ -1798,16 +1798,16 @@ ChanPendingObjCmd( switch ((enum options) index) { case PENDING_INPUT: if (!(mode & TCL_READABLE)) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-1)); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_InputBuffered(chan))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_InputBuffered(chan))); } break; case PENDING_OUTPUT: if (!(mode & TCL_WRITABLE)) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-1)); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_OutputBuffered(chan))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_OutputBuffered(chan))); } break; } @@ -1927,7 +1927,7 @@ ChanPipeObjCmd( channelNames[0] = Tcl_GetChannelName(rchan); channelNames[1] = Tcl_GetChannelName(wchan); - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(channelNames[0], -1)); Tcl_ListObjAppendElement(NULL, resultPtr, diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 896bdc8..698f3ce 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -1211,7 +1211,7 @@ ReflectInput( } if (Tcl_IsShared(bufObj)) { Tcl_DecrRefCount(bufObj); - bufObj = Tcl_NewObj(); + TclNewObj(bufObj); Tcl_IncrRefCount(bufObj); } Tcl_SetByteArrayLength(bufObj, 0); diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ce13966..3d6c47e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1735,7 +1735,7 @@ Tcl_FSEvalFileEx( } } - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); /* @@ -1871,7 +1871,7 @@ TclNREvalFile( } } - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); /* @@ -3766,7 +3766,7 @@ Tcl_Obj * Tcl_FSListVolumes(void) { FilesystemRecord *fsRecPtr; - Tcl_Obj *resultPtr = Tcl_NewObj(); + Tcl_Obj *resultPtr; /* * Call each "listVolumes" function of each registered filesystem in @@ -3774,6 +3774,7 @@ Tcl_FSListVolumes(void) * has succeeded. */ + TclNewObj(resultPtr); fsRecPtr = FsGetFirstFilesystem(); Claim(); while (fsRecPtr != NULL) { @@ -3833,7 +3834,7 @@ FsListMounts( if (fsRecPtr->fsPtr != &tclNativeFilesystem && fsRecPtr->fsPtr->matchInDirectoryProc != NULL) { if (resultPtr == NULL) { - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); } fsRecPtr->fsPtr->matchInDirectoryProc(NULL, resultPtr, pathPtr, pattern, &mountsOnly); @@ -3904,7 +3905,7 @@ Tcl_FSSplitPath( * For example, 'ftp://' is a valid drive name. */ - result = Tcl_NewObj(); + TclNewObj(result); p = TclGetString(pathPtr); Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(p, driveNameLength)); diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 0f6cc80..7df4581 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -564,7 +564,7 @@ PrefixMatchObjCmd( } Tcl_ListObjAppendElement(interp, errorPtr, Tcl_NewStringObj("-code", 5)); - Tcl_ListObjAppendElement(interp, errorPtr, Tcl_NewIntObj(result)); + Tcl_ListObjAppendElement(interp, errorPtr, Tcl_NewWideIntObj(result)); return Tcl_SetReturnOptions(interp, errorPtr); } diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 87a25db..7613264 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -541,7 +541,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #if !defined(_WIN32) # undef TclpGetPid -# define TclpGetPid(pid) ((size_t) (pid)) +# define TclpGetPid(pid) ((size_t)(pid)) #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 2703849..c990dc0 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1038,7 +1038,7 @@ NRInterpCmd( return TCL_ERROR; } iiPtr = (InterpInfo *) ((Interp *) childInterp)->interpInfo; - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); hPtr = Tcl_FirstHashEntry(&iiPtr->parent.childTable, &hashSearch); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) { string = (char *)Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr); @@ -1765,10 +1765,11 @@ AliasList( { Tcl_HashEntry *entryPtr; Tcl_HashSearch hashSearch; - Tcl_Obj *resultPtr = Tcl_NewObj(); + Tcl_Obj *resultPtr; Alias *aliasPtr; Child *childPtr; + TclNewObj(resultPtr); childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child; entryPtr = Tcl_FirstHashEntry(&childPtr->aliasTable, &hashSearch); @@ -2814,7 +2815,7 @@ ChildDebugCmd( iPtr = (Interp *) childInterp; if (objc == 0) { - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj("-frame", -1)); Tcl_ListObjAppendElement(NULL, resultPtr, @@ -3083,11 +3084,12 @@ ChildHidden( Tcl_Interp *interp, /* Interp for data return. */ Tcl_Interp *childInterp) /* Interp whose hidden commands to query. */ { - Tcl_Obj *listObjPtr = Tcl_NewObj(); /* Local object pointer. */ + Tcl_Obj *listObjPtr; /* Local object pointer. */ Tcl_HashTable *hTblPtr; /* For local searches. */ Tcl_HashEntry *hPtr; /* For local searches. */ Tcl_HashSearch hSearch; /* For local searches. */ + TclNewObj(listObjPtr); hTblPtr = ((Interp *) childInterp)->hiddenCmdTablePtr; if (hTblPtr != NULL) { for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); diff --git a/generic/tclLink.c b/generic/tclLink.c index 34a96f7..b9e37ba 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -1303,7 +1303,7 @@ ObjValue( return resultObj; } linkPtr->lastValue.i = LinkedVar(int); - return Tcl_NewIntObj(linkPtr->lastValue.i); + return Tcl_NewWideIntObj(linkPtr->lastValue.i); case TCL_LINK_WIDE_INT: if (linkPtr->flags & LINK_ALLOC_LAST) { memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes); @@ -1355,7 +1355,7 @@ ObjValue( return resultObj; } linkPtr->lastValue.c = LinkedVar(char); - return Tcl_NewIntObj(linkPtr->lastValue.c); + return Tcl_NewWideIntObj(linkPtr->lastValue.c); case TCL_LINK_UCHAR: if (linkPtr->flags & LINK_ALLOC_LAST) { memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes); @@ -1368,7 +1368,7 @@ ObjValue( return resultObj; } linkPtr->lastValue.uc = LinkedVar(unsigned char); - return Tcl_NewIntObj(linkPtr->lastValue.uc); + return Tcl_NewWideIntObj(linkPtr->lastValue.uc); case TCL_LINK_SHORT: if (linkPtr->flags & LINK_ALLOC_LAST) { memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes); @@ -1381,7 +1381,7 @@ ObjValue( return resultObj; } linkPtr->lastValue.s = LinkedVar(short); - return Tcl_NewIntObj(linkPtr->lastValue.s); + return Tcl_NewWideIntObj(linkPtr->lastValue.s); case TCL_LINK_USHORT: if (linkPtr->flags & LINK_ALLOC_LAST) { memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes); @@ -1394,7 +1394,7 @@ ObjValue( return resultObj; } linkPtr->lastValue.us = LinkedVar(unsigned short); - return Tcl_NewIntObj(linkPtr->lastValue.us); + return Tcl_NewWideIntObj(linkPtr->lastValue.us); case TCL_LINK_UINT: if (linkPtr->flags & LINK_ALLOC_LAST) { memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes); diff --git a/generic/tclListObj.c b/generic/tclListObj.c index d8ac783..9918b64 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -444,7 +444,9 @@ TclListObjRange( toIdx = listLen-1; } if (fromIdx + 1 > toIdx + 1) { - return Tcl_NewObj(); + Tcl_Obj *obj; + TclNewObj(obj); + return obj; } newLen = toIdx - fromIdx + 1; @@ -1356,7 +1358,7 @@ TclLindexFlat( return NULL; } } - listPtr = Tcl_NewObj(); + TclNewObj(listPtr); } else { /* * Extract the pointer to the appropriate element. @@ -1597,7 +1599,7 @@ TclLsetFlat( if (--indexCount) { parentList = subListPtr; if (index == (size_t)elemCount) { - subListPtr = Tcl_NewObj(); + TclNewObj(subListPtr); } else { subListPtr = elemPtrs[index]; } diff --git a/generic/tclLoad.c b/generic/tclLoad.c index e56fe47..72cba78 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -1071,7 +1071,7 @@ TclGetLoadedPackagesEx( Tcl_Obj *resultObj, *pkgDesc[2]; if (targetName == NULL) { - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); Tcl_MutexLock(&packageMutex); for (pkgPtr = firstPackagePtr; pkgPtr != NULL; pkgPtr = pkgPtr->nextPtr) { @@ -1117,7 +1117,7 @@ TclGetLoadedPackagesEx( * interpreter. */ - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) { pkgPtr = ipPtr->pkgPtr; pkgDesc[0] = Tcl_NewStringObj(pkgPtr->fileName, -1); diff --git a/generic/tclMain.c b/generic/tclMain.c index 38612b2..0eea074 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -307,7 +307,7 @@ Tcl_MainEx( is.interp = interp; is.prompt = PROMPT_START; - is.commandPtr = Tcl_NewObj(); + TclNewObj(is.commandPtr); /* * If the application has not already set a startup script, parse the @@ -348,7 +348,7 @@ Tcl_MainEx( argc--; argv++; - Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewIntObj(argc), TCL_GLOBAL_ONLY); + Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY); argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { @@ -362,7 +362,7 @@ Tcl_MainEx( is.tty = isatty(0); Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, - Tcl_NewIntObj(!path && is.tty), TCL_GLOBAL_ONLY); + Tcl_NewWideIntObj(!path && is.tty), TCL_GLOBAL_ONLY); /* * Invoke application-specific initialization. @@ -522,7 +522,7 @@ Tcl_MainEx( TCL_EVAL_GLOBAL); is.input = Tcl_GetStdChannel(TCL_STDIN); Tcl_DecrRefCount(is.commandPtr); - is.commandPtr = Tcl_NewObj(); + TclNewObj(is.commandPtr); Tcl_IncrRefCount(is.commandPtr); if (code != TCL_OK) { chan = Tcl_GetStdChannel(TCL_STDERR); @@ -791,7 +791,8 @@ StdinProc( code = Tcl_RecordAndEvalObj(interp, commandPtr, TCL_EVAL_GLOBAL); isPtr->input = chan = Tcl_GetStdChannel(TCL_STDIN); Tcl_DecrRefCount(commandPtr); - isPtr->commandPtr = commandPtr = Tcl_NewObj(); + TclNewObj(commandPtr); + isPtr->commandPtr = commandPtr; Tcl_IncrRefCount(commandPtr); if (chan != NULL) { Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, isPtr); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index bf59eac..8e71271 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -3547,9 +3547,10 @@ NamespaceExportCmd( */ if (objc == 1) { - Tcl_Obj *listPtr = Tcl_NewObj(); + Tcl_Obj *listPtr; - (void) Tcl_AppendExportList(interp, NULL, listPtr); + TclNewObj(listPtr); + (void)Tcl_AppendExportList(interp, NULL, listPtr); Tcl_SetObjResult(interp, listPtr); return TCL_OK; } @@ -4026,8 +4027,9 @@ NamespacePathCmd( */ if (objc == 1) { - Tcl_Obj *resultObj = Tcl_NewObj(); + Tcl_Obj *resultObj; + TclNewObj(resultObj); for (i=0 ; i<nsPtr->commandPathLength ; i++) { if (nsPtr->commandPathArray[i].nsPtr != NULL) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( @@ -5020,7 +5022,7 @@ TclLogCommandInfo( */ Tcl_ListObjAppendElement(NULL, iPtr->errorStack, iPtr->upLiteral); - Tcl_ListObjAppendElement(NULL, iPtr->errorStack, Tcl_NewIntObj( + Tcl_ListObjAppendElement(NULL, iPtr->errorStack, Tcl_NewWideIntObj( iPtr->framePtr->level - iPtr->varFramePtr->level)); } else if (iPtr->framePtr != iPtr->rootFramePtr) { /* diff --git a/generic/tclOO.c b/generic/tclOO.c index 5b685bc..0f0cc96 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -3035,7 +3035,7 @@ TclOOObjectName( if (oPtr->cachedNameObj) { return oPtr->cachedNameObj; } - namePtr = Tcl_NewObj(); + TclNewObj(namePtr); Tcl_GetCommandFullName(interp, oPtr->command, namePtr); Tcl_IncrRefCount(namePtr); oPtr->cachedNameObj = namePtr; diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 07e6901..6f277f7 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -831,7 +831,7 @@ TclOO_Object_VarName( * (including traversing variable links), convert back to a name. */ - varNamePtr = Tcl_NewObj(); + TclNewObj(varNamePtr); if (aryVar != NULL) { Tcl_GetVariableFullName(interp, (Tcl_Var) aryVar, varNamePtr); diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 9ff37cb..b7c3cda 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1050,8 +1050,8 @@ MagicDefinitionInvoke( * comments above for why these contortions are necessary. */ - objPtr = Tcl_NewObj(); - obj2Ptr = Tcl_NewObj(); + TclNewObj(objPtr); + TclNewObj(obj2Ptr); cmd = FindCommand(interp, objv[cmdIndex], nsPtr); if (cmd == NULL) { /* @@ -2338,7 +2338,7 @@ ClassFilterGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(filterObj, oPtr->classPtr->filters) { Tcl_ListObjAppendElement(NULL, resultObj, filterObj); } @@ -2419,7 +2419,7 @@ ClassMixinGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(mixinPtr, oPtr->classPtr->mixins) { Tcl_ListObjAppendElement(NULL, resultObj, TclOOObjectName(interp, mixinPtr->thisPtr)); @@ -2525,7 +2525,7 @@ ClassSuperGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(superPtr, oPtr->classPtr->superclasses) { Tcl_ListObjAppendElement(NULL, resultObj, TclOOObjectName(interp, superPtr->thisPtr)); @@ -2691,7 +2691,7 @@ ClassVarsGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (IsPrivateDefine(interp)) { PrivateVariableMapping *privatePtr; @@ -2800,7 +2800,7 @@ ObjFilterGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(filterObj, oPtr->filters) { Tcl_ListObjAppendElement(NULL, resultObj, filterObj); } @@ -2869,7 +2869,7 @@ ObjMixinGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(mixinPtr, oPtr->mixins) { if (mixinPtr) { Tcl_ListObjAppendElement(NULL, resultObj, @@ -2954,7 +2954,7 @@ ObjVarsGet( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (IsPrivateDefine(interp)) { PrivateVariableMapping *privatePtr; diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index 07eb185..c80b92f 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -206,11 +206,11 @@ InfoObjectClassCmd( continue; } if (TclOOIsReachable(o2clsPtr, mixinPtr)) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(1)); return TCL_OK; } } - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( TclOOIsReachable(o2clsPtr, oPtr->selfCls))); return TCL_OK; } @@ -270,13 +270,13 @@ InfoObjectDefnCmd( return TCL_ERROR; } - resultObjs[0] = Tcl_NewObj(); + TclNewObj(resultObjs[0]); for (localPtr=procPtr->firstLocalPtr; localPtr!=NULL; localPtr=localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { Tcl_Obj *argObj; - argObj = Tcl_NewObj(); + TclNewObj(argObj); Tcl_ListObjAppendElement(NULL, argObj, Tcl_NewStringObj(localPtr->name, -1)); if (localPtr->defValuePtr != NULL) { @@ -320,7 +320,7 @@ InfoObjectFiltersCmd( if (oPtr == NULL) { return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(filterObj, oPtr->filters) { Tcl_ListObjAppendElement(NULL, resultObj, filterObj); @@ -601,7 +601,7 @@ InfoObjectMethodsCmd( } } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (recurse) { const char **names; int i, numNames = TclOOGetSortedMethodList(oPtr, NULL, NULL, flag, @@ -713,7 +713,7 @@ InfoObjectMixinsCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(mixinPtr, oPtr->mixins) { if (!mixinPtr) { continue; @@ -753,7 +753,7 @@ InfoObjectIdCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(oPtr->creationEpoch)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(oPtr->creationEpoch)); return TCL_OK; } @@ -826,7 +826,7 @@ InfoObjectVariablesCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (isPrivate) { PrivateVariableMapping *privatePtr; @@ -878,7 +878,7 @@ InfoObjectVarsCmd( if (objc == 3) { pattern = TclGetString(objv[2]); } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); /* * Extract the information we need from the object's namespace's table of @@ -946,13 +946,13 @@ InfoClassConstrCmd( return TCL_ERROR; } - resultObjs[0] = Tcl_NewObj(); + TclNewObj(resultObjs[0]); for (localPtr=procPtr->firstLocalPtr; localPtr!=NULL; localPtr=localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { Tcl_Obj *argObj; - argObj = Tcl_NewObj(); + TclNewObj(argObj); Tcl_ListObjAppendElement(NULL, argObj, Tcl_NewStringObj(localPtr->name, -1)); if (localPtr->defValuePtr != NULL) { @@ -1014,13 +1014,13 @@ InfoClassDefnCmd( return TCL_ERROR; } - resultObjs[0] = Tcl_NewObj(); + TclNewObj(resultObjs[0]); for (localPtr=procPtr->firstLocalPtr; localPtr!=NULL; localPtr=localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { Tcl_Obj *argObj; - argObj = Tcl_NewObj(); + TclNewObj(argObj); Tcl_ListObjAppendElement(NULL, argObj, Tcl_NewStringObj(localPtr->name, -1)); if (localPtr->defValuePtr != NULL) { @@ -1158,7 +1158,7 @@ InfoClassFiltersCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(filterObj, clsPtr->filters) { Tcl_ListObjAppendElement(NULL, resultObj, filterObj); } @@ -1252,7 +1252,7 @@ InfoClassInstancesCmd( pattern = TclGetString(objv[2]); } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(oPtr, clsPtr->instances) { Tcl_Obj *tmpObj = TclOOObjectName(interp, oPtr); @@ -1356,7 +1356,7 @@ InfoClassMethodsCmd( } } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (recurse) { const char **names; int i, numNames = TclOOGetSortedClassMethodList(clsPtr, flag, &names); @@ -1463,7 +1463,7 @@ InfoClassMixinsCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(mixinPtr, clsPtr->mixins) { if (!mixinPtr) { continue; @@ -1509,7 +1509,7 @@ InfoClassSubsCmd( pattern = TclGetString(objv[2]); } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(subclassPtr, clsPtr->subclasses) { Tcl_Obj *tmpObj = TclOOObjectName(interp, subclassPtr->thisPtr); @@ -1560,7 +1560,7 @@ InfoClassSupersCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); FOREACH(superPtr, clsPtr->superclasses) { Tcl_ListObjAppendElement(NULL, resultObj, TclOOObjectName(interp, superPtr->thisPtr)); @@ -1605,7 +1605,7 @@ InfoClassVariablesCmd( return TCL_ERROR; } - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); if (isPrivate) { PrivateVariableMapping *privatePtr; diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 1b071fa..c4133bf 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -394,7 +394,7 @@ TclOONewProcMethod( if (argsObj == NULL) { argsLen = -1; - argsObj = Tcl_NewObj(); + TclNewObj(argsObj); Tcl_IncrRefCount(argsObj); procName = "<destructor>"; } else if (Tcl_ListObjLength(interp, argsObj, &argsLen) != TCL_OK) { @@ -1316,12 +1316,13 @@ CloneProcedureMethod( * Copy the argument list. */ - argsObj = Tcl_NewObj(); + TclNewObj(argsObj); for (localPtr=pmPtr->procPtr->firstLocalPtr; localPtr!=NULL; localPtr=localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { - Tcl_Obj *argObj = Tcl_NewObj(); + Tcl_Obj *argObj; + TclNewObj(argObj); Tcl_ListObjAppendElement(NULL, argObj, Tcl_NewStringObj(localPtr->name, -1)); if (localPtr->defValuePtr != NULL) { diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index e475372..647eb1c 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -720,7 +720,7 @@ TclPathPart( (Tcl_FSGetPathType(pathPtr) == TCL_PATH_RELATIVE))) { Tcl_ListObjIndex(NULL, splitPtr, splitElements-1, &resultPtr); } else { - resultPtr = Tcl_NewObj(); + TclNewObj(resultPtr); } } else { /* @@ -758,7 +758,7 @@ GetExtension( tail = TclGetString(pathPtr); extension = TclGetExtension(tail); if (extension == NULL) { - ret = Tcl_NewObj(); + TclNewObj(ret); } else { ret = Tcl_NewStringObj(extension, -1); } @@ -1035,7 +1035,7 @@ TclJoinPath( noQuickReturn: if (res == NULL) { - res = Tcl_NewObj(); + TclNewObj(res); } ptr = TclGetStringFromObj(res, &length); @@ -1271,7 +1271,7 @@ TclNewFSPathObj( return pathPtr; } - pathPtr = Tcl_NewObj(); + TclNewObj(pathPtr); fsPathPtr = (FsPath *)Tcl_Alloc(sizeof(FsPath)); /* diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 61a2080..94ed8e3 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -334,7 +334,7 @@ TclCleanupChildren( Tcl_Obj *objPtr; Tcl_Seek(errorChan, 0, SEEK_SET); - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); count = Tcl_ReadChars(errorChan, objPtr, -1, 0); if (count == -1) { result = TCL_ERROR; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 126e777..9681a52 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -285,7 +285,7 @@ TclPkgFileSeen( Tcl_Obj *list; if (isNew) { - list = Tcl_NewObj(); + TclNewObj(list); Tcl_SetHashValue(entry, list); Tcl_IncrRefCount(list); } else { @@ -1243,7 +1243,7 @@ TclNRPackageObjCmd( } else { Tcl_Obj *resultObj; - resultObj = Tcl_NewObj(); + TclNewObj(resultObj); tablePtr = &iPtr->packageTable; for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { @@ -1483,7 +1483,7 @@ TclNRPackageObjCmd( */ Tcl_SetObjResult(interp, - Tcl_NewIntObj(CompareVersions(iva, ivb, NULL))); + Tcl_NewWideIntObj(CompareVersions(iva, ivb, NULL))); Tcl_Free(iva); Tcl_Free(ivb); break; @@ -1492,8 +1492,9 @@ TclNRPackageObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "package"); return TCL_ERROR; } else { - Tcl_Obj *resultObj = Tcl_NewObj(); + Tcl_Obj *resultObj; + TclNewObj(resultObj); argv2 = TclGetString(objv[2]); hPtr = Tcl_FindHashEntry(&iPtr->packageTable, argv2); if (hPtr != NULL) { diff --git a/generic/tclProcess.c b/generic/tclProcess.c index f3fe6f7..bab2fca 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -222,7 +222,7 @@ WaitProcessStatus( * Get process status. */ - if (pid == (Tcl_Pid) -1) { + if (pid == (Tcl_Pid)-1) { /* * POSIX errName msg */ @@ -371,7 +371,7 @@ BuildProcessStatusObj( * Normal exit, return TCL_OK. */ - return Tcl_NewIntObj(TCL_OK); + return Tcl_NewWideIntObj(TCL_OK); } /* @@ -427,7 +427,7 @@ ProcessListObjCmd( entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); Tcl_ListObjAppendElement(interp, list, - Tcl_NewIntObj(info->resolvedPid)); + Tcl_NewWideIntObj(info->resolvedPid)); } Tcl_MutexUnlock(&infoTablesMutex); Tcl_SetObjResult(interp, list); @@ -523,7 +523,7 @@ ProcessStatusObjCmd( * Add to result. */ - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + Tcl_DictObjPut(interp, dict, Tcl_NewWideIntObj(info->resolvedPid), BuildProcessStatusObj(info)); } } @@ -573,7 +573,7 @@ ProcessStatusObjCmd( * Add to result. */ - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + Tcl_DictObjPut(interp, dict, Tcl_NewWideIntObj(info->resolvedPid), BuildProcessStatusObj(info)); } } @@ -834,7 +834,7 @@ TclProcessCreated( * Allocate and initialize info structure. */ - info = (ProcessInfo *) Tcl_Alloc(sizeof(ProcessInfo)); + info = (ProcessInfo *)Tcl_Alloc(sizeof(ProcessInfo)); InitProcessInfo(info, pid, resolvedPid); /* diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 0ddb65d..068b701 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -675,9 +675,9 @@ TclRegAbout( * well and Tcl has other limits that constrain things as well... */ - resultObj = Tcl_NewObj(); - Tcl_ListObjAppendElement(NULL, resultObj, - TclNewWideIntObjFromSize(regexpPtr->re.re_nsub)); + TclNewObj(resultObj); + TclNewIntObj(infoObj, regexpPtr->re.re_nsub); + Tcl_ListObjAppendElement(NULL, resultObj, infoObj); /* * Now append a list of all the bit-flags set for the RE. diff --git a/generic/tclResult.c b/generic/tclResult.c index 9168237..5584de4 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -823,9 +823,10 @@ TclMergeReturnOptions( int code = TCL_OK; int level = 1; Tcl_Obj *valuePtr; - Tcl_Obj *returnOpts = Tcl_NewObj(); + Tcl_Obj *returnOpts; Tcl_Obj **keys = GetKeys(); + TclNewObj(returnOpts); for (; objc > 1; objv += 2, objc -= 2) { const char *opt = TclGetString(objv[0]); const char *compare = TclGetString(keys[KEY_OPTIONS]); @@ -1019,19 +1020,19 @@ Tcl_GetReturnOptions( if (iPtr->returnOpts) { options = Tcl_DuplicateObj(iPtr->returnOpts); } else { - options = Tcl_NewObj(); + TclNewObj(options); } if (result == TCL_RETURN) { Tcl_DictObjPut(NULL, options, keys[KEY_CODE], - Tcl_NewIntObj(iPtr->returnCode)); + Tcl_NewWideIntObj(iPtr->returnCode)); Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL], - Tcl_NewIntObj(iPtr->returnLevel)); + Tcl_NewWideIntObj(iPtr->returnLevel)); } else { Tcl_DictObjPut(NULL, options, keys[KEY_CODE], - Tcl_NewIntObj(result)); + Tcl_NewWideIntObj(result)); Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL], - Tcl_NewIntObj(0)); + Tcl_NewWideIntObj(0)); } if (result == TCL_ERROR) { @@ -1044,7 +1045,7 @@ Tcl_GetReturnOptions( if (iPtr->errorInfo) { Tcl_DictObjPut(NULL, options, keys[KEY_ERRORINFO], iPtr->errorInfo); Tcl_DictObjPut(NULL, options, keys[KEY_ERRORLINE], - Tcl_NewIntObj(iPtr->errorLine)); + Tcl_NewWideIntObj(iPtr->errorLine)); } return options; } diff --git a/generic/tclScan.c b/generic/tclScan.c index c4738ad..6ca76c4 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -1068,7 +1068,7 @@ Tcl_ScanObjCmd( * Here no vars were specified, we want a list returned (inline scan) */ - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); for (i = 0; i < totalVars; i++) { if (objs[i] != NULL) { Tcl_ListObjAppendElement(NULL, objPtr, objs[i]); @@ -1089,12 +1089,12 @@ Tcl_ScanObjCmd( if (code == TCL_OK) { if (underflow && (nconversions == 0)) { if (numVars) { - objPtr = Tcl_NewWideIntObj(-1); + TclNewIntObj(objPtr, -1); } else { if (objPtr) { Tcl_SetListObj(objPtr, 0, NULL); } else { - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); } } } else if (numVars) { diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7ba20ec..5a16b85 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2036,7 +2036,7 @@ Tcl_AppendFormatToObj( if (l == (long) 0) gotHash = 0; } - segment = Tcl_NewObj(); + TclNewObj(segment); allocSegment = 1; segmentLimit = INT_MAX; Tcl_IncrRefCount(segment); @@ -2204,7 +2204,7 @@ Tcl_AppendFormatToObj( if (numDigits == 0) { numDigits = 1; } - pure = Tcl_NewObj(); + TclNewObj(pure); Tcl_SetObjLength(pure, numDigits); bytes = TclGetString(pure); toAppend = length = numDigits; @@ -2325,7 +2325,7 @@ Tcl_AppendFormatToObj( *p++ = (char) ch; *p = '\0'; - segment = Tcl_NewObj(); + TclNewObj(segment); allocSegment = 1; if (!Tcl_AttemptSetObjLength(segment, length)) { msg = overflow; @@ -3208,7 +3208,7 @@ TclStringCat( /* assert ( length > start ) */ TclFreeIntRep(objResultPtr); } else { - objResultPtr = Tcl_NewObj(); /* PANIC? */ + TclNewObj(objResultPtr); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { Tcl_DecrRefCount(objResultPtr); if (interp) { @@ -3455,7 +3455,7 @@ TclStringFirst( { size_t lh = 0, ln = Tcl_GetCharLength(needle); size_t value = TCL_INDEX_NONE; - Tcl_UniChar *check, *end, *uh, *un; + Tcl_UniChar *check, *end, *uh, *un; if (start == TCL_INDEX_NONE) { start = 0; @@ -3560,7 +3560,7 @@ TclStringLast( { size_t lh = 0, ln = Tcl_GetCharLength(needle); size_t value = TCL_INDEX_NONE; - Tcl_UniChar *check, *uh, *un; + Tcl_UniChar *check, *uh, *un; if (ln == 0) { /* @@ -3721,7 +3721,7 @@ TclStringReverse( char *to, *from = objPtr->bytes; if (!inPlace || Tcl_IsShared(objPtr)) { - objPtr = Tcl_NewObj(); + TclNewObj(objPtr); Tcl_SetObjLength(objPtr, numBytes); } to = objPtr->bytes; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 9c8480b..9c4c2d03 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -194,7 +194,7 @@ void *TclWinGetTclInstance() size_t TclpGetPid(Tcl_Pid pid) { - return (size_t) pid; + return (size_t)pid; } #if defined(TCL_WIDE_INT_IS_LONG) diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index f754caa..f566eb2 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -413,7 +413,7 @@ ThreadObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT))); return TCL_OK; } diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 8118272..133c44e 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -942,8 +942,9 @@ Tcl_AfterObjCmd( break; case AFTER_INFO: if (objc == 2) { - Tcl_Obj *resultObj = Tcl_NewObj(); + Tcl_Obj *resultObj; + TclNewObj(resultObj); for (afterPtr = assocPtr->firstAfterPtr; afterPtr != NULL; afterPtr = afterPtr->nextPtr) { if (assocPtr->interp == interp) { @@ -967,8 +968,9 @@ Tcl_AfterObjCmd( Tcl_SetErrorCode(interp, "TCL","LOOKUP","EVENT", eventStr, NULL); return TCL_ERROR; } else { - Tcl_Obj *resultListPtr = Tcl_NewObj(); + Tcl_Obj *resultListPtr; + TclNewObj(resultListPtr); Tcl_ListObjAppendElement(interp, resultListPtr, afterPtr->commandPtr); Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj( diff --git a/generic/tclTrace.c b/generic/tclTrace.c index fdb158a..0b1fe4e 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -277,7 +277,7 @@ Tcl_TraceObjCmd( return TCL_ERROR; } - opsList = Tcl_NewObj(); + TclNewObj(opsList); Tcl_IncrRefCount(opsList); flagOps = TclGetStringFromObj(objv[3], &numFlags); if (numFlags == 0) { @@ -321,7 +321,7 @@ Tcl_TraceObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "name"); return TCL_ERROR; } - resultListPtr = Tcl_NewObj(); + TclNewObj(resultListPtr); name = TclGetString(objv[2]); FOREACH_VAR_TRACE(interp, name, clientData) { TraceVarInfo *tvarPtr = (TraceVarInfo *)clientData; @@ -966,7 +966,7 @@ TraceVariableObjCmd( return TCL_ERROR; } - resultListPtr = Tcl_NewObj(); + TclNewObj(resultListPtr); name = TclGetString(objv[3]); FOREACH_VAR_TRACE(interp, name, clientData) { Tcl_Obj *opObjPtr, *eachTraceObjPtr, *elemObjPtr; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 11b557f..f4ccfc8 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1979,7 +1979,7 @@ Tcl_ConcatObj( } } if (!resPtr) { - resPtr = Tcl_NewObj(); + TclNewObj(resPtr); } return resPtr; } diff --git a/generic/tclVar.c b/generic/tclVar.c index 487f243..8696bd0 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -4140,7 +4140,7 @@ ArraySizeCmd( } } - Tcl_SetObjResult(interp, Tcl_NewIntObj(size)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(size)); return TCL_OK; } @@ -5248,7 +5248,8 @@ TclDeleteNamespaceVars( for (varPtr = VarHashFirstVar(tablePtr, &search); varPtr != NULL; varPtr = VarHashFirstVar(tablePtr, &search)) { - Tcl_Obj *objPtr = Tcl_NewObj(); + Tcl_Obj *objPtr; + TclNewObj(objPtr); VarHashRefCount(varPtr)++; /* Make sure we get to remove from * hash. */ Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr); @@ -5921,7 +5922,7 @@ TclInfoVarsCmd( if (!TclIsVarUndefined(varPtr) || TclIsVarNamespaceVar(varPtr)) { if (specificNsInPattern) { - elemObjPtr = Tcl_NewObj(); + TclNewObj(elemObjPtr); Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, elemObjPtr); } else { @@ -5954,7 +5955,7 @@ TclInfoVarsCmd( if ((simplePattern == NULL) || Tcl_StringMatch(varName, simplePattern)) { if (specificNsInPattern) { - elemObjPtr = Tcl_NewObj(); + TclNewObj(elemObjPtr); Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, elemObjPtr); } else { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e3ddc83..dd049e6 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3224,7 +3224,7 @@ ZipFSTclLibraryObjCmd( Tcl_Obj *pResult = TclZipfs_TclLibrary(); if (!pResult) { - pResult = Tcl_NewObj(); + TclNewObj(pResult); } Tcl_SetObjResult(interp, pResult); } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 383b1e2..8f1ebe4 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -354,7 +354,7 @@ ConvertErrorToList( return Tcl_NewListObj(4, objv); case Z_NEED_DICT: TclNewLiteralStringObj(objv[2], "NEED_DICT"); - objv[3] = Tcl_NewWideIntObj((Tcl_WideInt) adler); + TclNewIntObj(objv[3], (Tcl_WideInt)adler); return Tcl_NewListObj(4, objv); /* @@ -2171,7 +2171,7 @@ ZlibCmd( break; case 1: headerVarObj = objv[i+1]; - headerDictObj = Tcl_NewObj(); + TclNewObj(headerDictObj); break; } } @@ -3496,8 +3496,9 @@ ZlibTransformGetOption( if ((cd->flags & IN_HEADER) && ((optionName == NULL) || (strcmp(optionName, "-header") == 0))) { - Tcl_Obj *tmpObj = Tcl_NewObj(); + Tcl_Obj *tmpObj; + TclNewObj(tmpObj); ExtractHeader(&cd->inHeader.header, tmpObj); if (optionName == NULL) { Tcl_DStringAppendElement(dsPtr, "-header"); |