summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclBasic.c10
-rw-r--r--generic/tclBinary.c10
-rw-r--r--generic/tclCompCmds.c35
-rw-r--r--generic/tclCompCmdsGR.c19
-rw-r--r--generic/tclCompCmdsSZ.c14
-rw-r--r--generic/tclCompExpr.c22
-rw-r--r--generic/tclCompile.c5
-rw-r--r--generic/tclDisassemble.c29
-rw-r--r--generic/tclEncoding.c6
-rw-r--r--generic/tclEnsemble.c8
-rw-r--r--generic/tclIOCmd.c8
-rw-r--r--generic/tclIORTrans.c2
-rw-r--r--generic/tclIOUtil.c11
-rw-r--r--generic/tclInterp.c10
-rw-r--r--generic/tclOO.c2
-rw-r--r--generic/tclOOBasic.c2
-rw-r--r--generic/tclOODefineCmds.c18
-rw-r--r--generic/tclOOInfo.c36
-rw-r--r--generic/tclOOMethod.c7
-rw-r--r--generic/tclPathObj.c11
-rw-r--r--generic/tclPipe.c2
-rw-r--r--generic/tclPkg.c5
-rw-r--r--generic/tclRegexp.c2
-rw-r--r--generic/tclResult.c10
-rw-r--r--generic/tclStringObj.c11
-rw-r--r--generic/tclTimer.c18
26 files changed, 172 insertions, 141 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index aebcab7..5975fd3 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -517,7 +517,7 @@ Tcl_CreateInterp(void)
iPtr->result = iPtr->resultSpace;
iPtr->freeProc = NULL;
iPtr->errorLine = 0;
- iPtr->objResultPtr = Tcl_NewObj();
+ TclNewObj(iPtr->objResultPtr);
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
iPtr->globalNsPtr = NULL;
@@ -606,7 +606,7 @@ Tcl_CreateInterp(void)
iPtr->activeInterpTracePtr = NULL;
iPtr->assocData = NULL;
iPtr->execEnvPtr = NULL; /* Set after namespaces initialized. */
- iPtr->emptyObjPtr = Tcl_NewObj();
+ TclNewObj(iPtr->emptyObjPtr);
/* Another empty object. */
Tcl_IncrRefCount(iPtr->emptyObjPtr);
iPtr->resultSpace[0] = 0;
@@ -671,7 +671,7 @@ Tcl_CreateInterp(void)
* TIP #285, Script cancellation support.
*/
- iPtr->asyncCancelMsg = Tcl_NewObj();
+ TclNewObj(iPtr->asyncCancelMsg);
cancelInfo = (CancelInfo *)ckalloc(sizeof(CancelInfo));
cancelInfo->interp = interp;
@@ -2652,7 +2652,7 @@ TclRenameCommand(
}
cmdNsPtr = cmdPtr->nsPtr;
- oldFullName = Tcl_NewObj();
+ TclNewObj(oldFullName);
Tcl_IncrRefCount(oldFullName);
Tcl_GetCommandFullName(interp, cmd, oldFullName);
@@ -3857,7 +3857,7 @@ Tcl_ListMathFuncs(
if (TCL_OK == Tcl_EvalObjEx(interp, script, 0)) {
result = Tcl_DuplicateObj(Tcl_GetObjResult(interp));
} else {
- result = Tcl_NewObj();
+ TclNewObj(result);
}
Tcl_DecrRefCount(script);
Tcl_RestoreInterpState(interp, state);
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 6f36d54..5d317fa 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -927,7 +927,7 @@ BinaryFormatCmd(
* bytes and filling with nulls.
*/
- resultPtr = Tcl_NewObj();
+ TclNewObj(resultPtr);
buffer = Tcl_SetByteArrayLength(resultPtr, length);
memset(buffer, 0, length);
@@ -1360,7 +1360,7 @@ BinaryScanCmd(
}
}
src = buffer + offset;
- valuePtr = Tcl_NewObj();
+ TclNewObj(valuePtr);
Tcl_SetObjLength(valuePtr, count);
dest = TclGetString(valuePtr);
@@ -1415,7 +1415,7 @@ BinaryScanCmd(
}
}
src = buffer + offset;
- valuePtr = Tcl_NewObj();
+ TclNewObj(valuePtr);
Tcl_SetObjLength(valuePtr, count);
dest = TclGetString(valuePtr);
@@ -1499,7 +1499,7 @@ BinaryScanCmd(
if ((length - offset) < (count * size)) {
goto done;
}
- valuePtr = Tcl_NewObj();
+ TclNewObj(valuePtr);
src = buffer + offset;
for (i = 0; i < count; i++) {
elementPtr = ScanNumber(src, cmd, flags, &numberCachePtr);
@@ -2521,7 +2521,7 @@ BinaryEncode64(
maxlen = 0;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
if (count > 0) {
unsigned char *cursor = NULL;
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c8970ce..f28175b 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -311,7 +311,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);
@@ -890,10 +890,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);
@@ -1288,10 +1288,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);
@@ -1299,7 +1299,7 @@ TclCompileDictCreateCmd(
goto nonConstant;
}
tokenPtr = TokenAfter(tokenPtr);
- valueObj = Tcl_NewObj();
+ TclNewObj(valueObj);
Tcl_IncrRefCount(valueObj);
if (!TclWordKnownAtCompileTime(tokenPtr, valueObj)) {
Tcl_DecrRefCount(keyObj);
@@ -2298,8 +2298,9 @@ DisassembleDictUpdateInfo(
{
DictUpdateInfo *duiPtr = clientData;
int 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]));
@@ -2722,7 +2723,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)) {
@@ -3041,7 +3042,7 @@ DisassembleForeachInfo(
* Data stores.
*/
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
for (i=0 ; i<infoPtr->numLists ; i++) {
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(infoPtr->firstValueTemp + i));
@@ -3059,9 +3060,9 @@ DisassembleForeachInfo(
* 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,
@@ -3095,9 +3096,9 @@ DisassembleNewForeachInfo(
* 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,
@@ -3155,7 +3156,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)) {
@@ -3166,7 +3167,7 @@ TclCompileFormatCmd(
objv = ckalloc((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;
@@ -3258,7 +3259,7 @@ TclCompileFormatCmd(
start = Tcl_GetString(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 == '%') {
@@ -3276,7 +3277,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 c453878..a324706 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -54,9 +54,10 @@ TclGetIndexFromToken(
int 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;
@@ -1180,9 +1181,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 {
@@ -2289,7 +2290,7 @@ TclCompileRegsubCmd(
Tcl_DStringInit(&pattern);
tokenPtr = TokenAfter(tokenPtr);
- patternObj = Tcl_NewObj();
+ TclNewObj(patternObj);
if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) {
goto done;
}
@@ -2300,7 +2301,7 @@ TclCompileRegsubCmd(
}
tokenPtr = TokenAfter(tokenPtr);
Tcl_DecrRefCount(patternObj);
- patternObj = Tcl_NewObj();
+ TclNewObj(patternObj);
if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) {
goto done;
}
@@ -2315,7 +2316,7 @@ TclCompileRegsubCmd(
stringTokenPtr = TokenAfter(tokenPtr);
tokenPtr = TokenAfter(stringTokenPtr);
- replacementObj = Tcl_NewObj();
+ TclNewObj(replacementObj);
if (!TclWordKnownAtCompileTime(tokenPtr, replacementObj)) {
goto done;
}
@@ -2466,7 +2467,7 @@ TclCompileReturnCmd(
*/
for (objc = 0; objc < numOptionWords; objc++) {
- objv[objc] = Tcl_NewObj();
+ TclNewObj(objv[objc]);
Tcl_IncrRefCount(objv[objc]);
if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) {
/*
@@ -2686,7 +2687,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 ddfe0dc..862ebb5 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -248,7 +248,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);
@@ -482,7 +482,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;
@@ -878,7 +878,7 @@ TclCompileStringMapCmd(
}
mapTokenPtr = TokenAfter(parsePtr->tokenPtr);
stringTokenPtr = TokenAfter(mapTokenPtr);
- mapObj = Tcl_NewObj();
+ TclNewObj(mapObj);
Tcl_IncrRefCount(mapObj);
if (!TclWordKnownAtCompileTime(mapTokenPtr, mapObj)) {
Tcl_DecrRefCount(mapObj);
@@ -1418,7 +1418,7 @@ TclCompileSubstCmd(
objv = 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++;
@@ -2570,12 +2570,13 @@ DisassembleJumptableInfo(
unsigned int pcOffset)
{
JumptableInfo *jtPtr = clientData;
- Tcl_Obj *mapping = Tcl_NewObj();
+ Tcl_Obj *mapping;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
const char *keyPtr;
int offset;
+ TclNewObj(mapping);
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
@@ -3587,8 +3588,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 52b62fc..ca9a21a 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -1001,7 +1001,7 @@ ParseExpr(
* later.
*/
- literal = Tcl_NewObj();
+ TclNewObj(literal);
if (TclWordKnownAtCompileTime(tokenPtr, literal)) {
Tcl_ListObjAppendElement(NULL, litList, literal);
complete = lastParsed = OT_LITERAL;
@@ -1828,8 +1828,8 @@ 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 = TclStackAlloc(interp, sizeof(Tcl_Parse));
/* Holds the Tcl_Tokens of substitutions. */
@@ -1837,6 +1837,8 @@ Tcl_ParseExpr(
numBytes = (start ? strlen(start) : 0);
}
+ TclNewObj(litList);
+ TclNewObj(funcList);
code = ParseExpr(interp, start, numBytes, &opTree, litList, funcList,
exprParsePtr, 1 /* parseOnly */);
Tcl_DecrRefCount(funcList);
@@ -2003,7 +2005,7 @@ ParseLexeme(
}
}
- 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)) {
@@ -2117,12 +2119,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 = 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) {
@@ -2181,9 +2186,10 @@ ExecConstantExprTree(
CompileEnv *envPtr;
ByteCode *byteCodePtr;
int code;
- Tcl_Obj *byteCodeObj = Tcl_NewObj();
+ Tcl_Obj *byteCodeObj;
NRE_callback *rootPtr = TOP_CB(interp);
+ TclNewObj(byteCodeObj);
/*
* Note we are compiling an expression with literal arguments. This means
* there can be no [info frame] calls when we execute the resulting
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 4a50089..9a59b71 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1710,7 +1710,7 @@ TclWordKnownAtCompileTime(
}
tokenPtr++;
if (valuePtr != NULL) {
- tempPtr = Tcl_NewObj();
+ TclNewObj(tempPtr);
Tcl_IncrRefCount(tempPtr);
}
while (numComponents--) {
@@ -1999,7 +1999,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;
@@ -2010,6 +2010,7 @@ CompileCommandTokens(
int startCodeOffset = envPtr->codeNext - envPtr->codeStart;
int depth = TclGetStackDepth(envPtr);
+ TclNewObj(cmdObj);
assert (parsePtr->numWords > 0);
/* Pre-Compile */
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 8b137d4..3b03c42 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -798,8 +798,9 @@ Tcl_Obj *
TclNewInstNameObj(
unsigned char inst)
{
- Tcl_Obj *objPtr = Tcl_NewObj();
+ Tcl_Obj *objPtr;
+ TclNewObj(objPtr);
objPtr->typePtr = &tclInstNameType;
objPtr->internalRep.longValue = (long) inst;
objPtr->bytes = NULL;
@@ -943,7 +944,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]);
}
@@ -952,7 +953,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;
@@ -960,7 +961,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));
@@ -1000,12 +1001,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;
@@ -1103,21 +1104,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);
}
@@ -1128,7 +1131,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];
@@ -1163,7 +1166,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;
@@ -1176,7 +1179,7 @@ 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_DictObjPut(NULL, cmd, Tcl_NewStringObj("codeto", -1),
@@ -1211,7 +1214,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),
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 8fff493..4c59bc6 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -481,12 +481,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);
@@ -903,10 +904,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 7f47510..bdf4d84 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2913,7 +2913,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;
@@ -2921,6 +2921,7 @@ TclCompileEnsemble(
unsigned numBytes;
const char *word;
+ TclNewObj(replaced);
Tcl_IncrRefCount(replaced);
if (parsePtr->numWords < depth + 1) {
goto failed;
@@ -3424,7 +3425,7 @@ CompileToInvokedCommand(
* the implementation.
*/
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
bytes = Tcl_GetStringFromObj(objPtr, &length);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
@@ -3463,8 +3464,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/tclIOCmd.c b/generic/tclIOCmd.c
index af1295f..f11a4ab 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -323,7 +323,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)) {
@@ -463,7 +463,7 @@ Tcl_ReadObjCmd(
}
}
- resultPtr = Tcl_NewObj();
+ TclNewObj(resultPtr);
Tcl_IncrRefCount(resultPtr);
TclChannelPreserve(chan);
charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0);
@@ -991,7 +991,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) < 0) {
/*
@@ -1903,7 +1903,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 eecd412..97540a6 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -1224,7 +1224,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 312fd08..1f8076a 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1775,7 +1775,7 @@ Tcl_FSEvalFileEx(
}
}
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
/*
@@ -1909,7 +1909,7 @@ TclNREvalFile(
}
}
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
/*
@@ -3878,8 +3878,9 @@ Tcl_Obj *
Tcl_FSListVolumes(void)
{
FilesystemRecord *fsRecPtr;
- Tcl_Obj *resultPtr = Tcl_NewObj();
+ Tcl_Obj *resultPtr;
+ TclNewObj(resultPtr);
/*
* Call each of the "listVolumes" function in succession. A non-NULL
* return value indicates the particular function has succeeded. We call
@@ -3945,7 +3946,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);
@@ -4021,7 +4022,7 @@ Tcl_FSSplitPath(
* slashes (for example 'ftp://' is a valid vfs drive name)
*/
- result = Tcl_NewObj();
+ TclNewObj(result);
p = Tcl_GetString(pathPtr);
Tcl_ListObjAppendElement(NULL, result,
Tcl_NewStringObj(p, driveNameLength));
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 4f5b300..271bbf2 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -1021,7 +1021,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 = Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
@@ -1748,10 +1748,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);
@@ -2725,7 +2726,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,
@@ -2994,11 +2995,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/tclOO.c b/generic/tclOO.c
index 053abfe..9a32543 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -2925,7 +2925,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 b7f70e7..e746b64 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -727,7 +727,7 @@ TclOO_Object_VarName(
* (including traversing variable links), convert back to a name.
*/
- varNamePtr = Tcl_NewObj();
+ TclNewObj(varNamePtr);
if (aryVar != NULL) {
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index aeee165..c1115be 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -850,8 +850,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) {
/*
@@ -1874,7 +1874,7 @@ ClassFilterGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(filterObj, oPtr->classPtr->filters) {
Tcl_ListObjAppendElement(NULL, resultObj, filterObj);
}
@@ -1954,7 +1954,7 @@ ClassMixinGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(mixinPtr, oPtr->classPtr->mixins) {
Tcl_ListObjAppendElement(NULL, resultObj,
TclOOObjectName(interp, mixinPtr->thisPtr));
@@ -2059,7 +2059,7 @@ ClassSuperGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(superPtr, oPtr->classPtr->superclasses) {
Tcl_ListObjAppendElement(NULL, resultObj,
TclOOObjectName(interp, superPtr->thisPtr));
@@ -2224,7 +2224,7 @@ ClassVarsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(variableObj, oPtr->classPtr->variables) {
Tcl_ListObjAppendElement(NULL, resultObj, variableObj);
}
@@ -2360,7 +2360,7 @@ ObjFilterGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(filterObj, oPtr->filters) {
Tcl_ListObjAppendElement(NULL, resultObj, filterObj);
}
@@ -2428,7 +2428,7 @@ ObjMixinGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(mixinPtr, oPtr->mixins) {
if (mixinPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
@@ -2512,7 +2512,7 @@ ObjVarsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(variableObj, oPtr->variables) {
Tcl_ListObjAppendElement(NULL, resultObj, variableObj);
}
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index 4b25c1a..9f1233c 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -266,13 +266,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) {
@@ -316,7 +316,7 @@ InfoObjectFiltersCmd(
if (oPtr == NULL) {
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(filterObj, oPtr->filters) {
Tcl_ListObjAppendElement(NULL, resultObj, filterObj);
@@ -560,7 +560,7 @@ InfoObjectMethodsCmd(
}
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
if (recurse) {
const char **names;
int i, numNames = TclOOGetSortedMethodList(oPtr, flag, &names);
@@ -671,7 +671,7 @@ InfoObjectMixinsCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(mixinPtr, oPtr->mixins) {
if (!mixinPtr) {
continue;
@@ -746,7 +746,7 @@ InfoObjectVariablesCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(variableObj, oPtr->variables) {
Tcl_ListObjAppendElement(NULL, resultObj, variableObj);
}
@@ -788,7 +788,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
@@ -856,13 +856,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) {
@@ -924,13 +924,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) {
@@ -1018,7 +1018,7 @@ InfoClassFiltersCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(filterObj, clsPtr->filters) {
Tcl_ListObjAppendElement(NULL, resultObj, filterObj);
}
@@ -1112,7 +1112,7 @@ InfoClassInstancesCmd(
pattern = TclGetString(objv[2]);
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(oPtr, clsPtr->instances) {
Tcl_Obj *tmpObj = TclOOObjectName(interp, oPtr);
@@ -1183,7 +1183,7 @@ InfoClassMethodsCmd(
}
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
if (recurse) {
const char **names;
int i, numNames = TclOOGetSortedClassMethodList(clsPtr, flag, &names);
@@ -1290,7 +1290,7 @@ InfoClassMixinsCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(mixinPtr, clsPtr->mixins) {
if (!mixinPtr) {
continue;
@@ -1336,7 +1336,7 @@ InfoClassSubsCmd(
pattern = TclGetString(objv[2]);
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(subclassPtr, clsPtr->subclasses) {
Tcl_Obj *tmpObj = TclOOObjectName(interp, subclassPtr->thisPtr);
@@ -1387,7 +1387,7 @@ InfoClassSupersCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(superPtr, clsPtr->superclasses) {
Tcl_ListObjAppendElement(NULL, resultObj,
TclOOObjectName(interp, superPtr->thisPtr));
@@ -1426,7 +1426,7 @@ InfoClassVariablesCmd(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(variableObj, clsPtr->variables) {
Tcl_ListObjAppendElement(NULL, resultObj, variableObj);
}
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index cd3c2c2..80e8478 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) {
@@ -1293,12 +1293,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 d919c40..b69607a 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -743,7 +743,7 @@ TclPathPart(
(Tcl_FSGetPathType(pathPtr) == TCL_PATH_RELATIVE))) {
Tcl_ListObjIndex(NULL, splitPtr, splitElements-1, &resultPtr);
} else {
- resultPtr = Tcl_NewObj();
+ TclNewObj(resultPtr);
}
} else {
/*
@@ -781,7 +781,7 @@ GetExtension(
tail = TclGetString(pathPtr);
extension = TclGetExtension(tail);
if (extension == NULL) {
- ret = Tcl_NewObj();
+ TclNewObj(ret);
} else {
ret = Tcl_NewStringObj(extension, -1);
}
@@ -857,7 +857,8 @@ TclJoinPath(
assert ( elements >= 0 );
if (elements == 0) {
- return Tcl_NewObj();
+ TclNewObj(res);
+ return res;
}
assert ( elements > 0 );
@@ -1056,7 +1057,7 @@ TclJoinPath(
noQuickReturn:
if (res == NULL) {
- res = Tcl_NewObj();
+ TclNewObj(res);
ptr = Tcl_GetStringFromObj(res, &length);
} else {
ptr = Tcl_GetStringFromObj(res, &length);
@@ -1317,7 +1318,7 @@ TclNewFSPathObj(
return pathPtr;
}
- pathPtr = Tcl_NewObj();
+ TclNewObj(pathPtr);
fsPathPtr = ckalloc(sizeof(FsPath));
/*
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 7d5fab0..f5c82f1 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -371,7 +371,7 @@ TclCleanupChildren(
Tcl_Obj *objPtr;
Tcl_Seek(errorChan, (Tcl_WideInt)0, SEEK_SET);
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
if (count < 0) {
result = TCL_ERROR;
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 2150c31..67c91c4 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -1014,7 +1014,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)) {
@@ -1257,8 +1257,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/tclRegexp.c b/generic/tclRegexp.c
index 2070956..bd923ba 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -677,7 +677,7 @@ TclRegAbout(
* well and Tcl has other limits that constrain things as well...
*/
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewIntObj((int) regexpPtr->re.re_nsub));
diff --git a/generic/tclResult.c b/generic/tclResult.c
index b1cf9ee..be84a61 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -245,7 +245,7 @@ Tcl_SaveResult(
*/
statePtr->objResultPtr = iPtr->objResultPtr;
- iPtr->objResultPtr = Tcl_NewObj();
+ TclNewObj(iPtr->objResultPtr);
Tcl_IncrRefCount(iPtr->objResultPtr);
/*
@@ -1026,13 +1026,14 @@ Tcl_SetErrorCodeVA(
Tcl_Interp *interp, /* Interpreter in which to set errorCode */
va_list argList) /* Variable argument list. */
{
- Tcl_Obj *errorObj = Tcl_NewObj();
+ Tcl_Obj *errorObj;
/*
* Scan through the arguments one at a time, appending them to the
* errorCode field as list elements.
*/
+ TclNewObj(errorObj);
while (1) {
char *elem = va_arg(argList, char *);
@@ -1387,9 +1388,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) {
int optLen;
const char *opt = TclGetStringFromObj(objv[0], &optLen);
@@ -1585,7 +1587,7 @@ Tcl_GetReturnOptions(
if (iPtr->returnOpts) {
options = Tcl_DuplicateObj(iPtr->returnOpts);
} else {
- options = Tcl_NewObj();
+ TclNewObj(options);
}
if (result == TCL_RETURN) {
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index fc675cf..756b948 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -776,7 +776,8 @@ Tcl_GetRange(
last = length - 1;
}
if (last < first) {
- return Tcl_NewObj();
+ TclNewObj(newObjPtr);
+ return newObjPtr;
}
return Tcl_NewByteArrayObj(bytes + first, last - first + 1);
}
@@ -801,9 +802,10 @@ Tcl_GetRange(
last = stringPtr->numChars - 1;
}
if (last < first) {
- return Tcl_NewObj();
+ TclNewObj(newObjPtr);
+ return newObjPtr;
}
- newObjPtr = Tcl_NewStringObj(objPtr->bytes + first, last-first+1);
+ newObjPtr = Tcl_NewStringObj(objPtr->bytes + first, last - first + 1);
/*
* Since we know the char length of the result, store it.
@@ -821,7 +823,8 @@ Tcl_GetRange(
last = stringPtr->numChars - 1;
}
if (last < first) {
- return Tcl_NewObj();
+ TclNewObj(newObjPtr);
+ return newObjPtr;
}
#if TCL_UTF_MAX == 4
/* See: bug [11ae2be95dac9417] */
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index d30879f..500a75e 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -949,13 +949,14 @@ 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) {
- Tcl_ListObjAppendElement(NULL, resultObj, Tcl_ObjPrintf(
- "after#%d", afterPtr->id));
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_ObjPrintf(
+ "after#%d", afterPtr->id));
}
}
Tcl_SetObjResult(interp, resultObj);
@@ -974,14 +975,15 @@ Tcl_AfterObjCmd(
Tcl_SetErrorCode(interp, "TCL","LOOKUP","EVENT", eventStr, NULL);
return TCL_ERROR;
} else {
- Tcl_Obj *resultListPtr = Tcl_NewObj();
+ Tcl_Obj *resultListPtr;
- Tcl_ListObjAppendElement(interp, resultListPtr,
- afterPtr->commandPtr);
- Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
+ TclNewObj(resultListPtr);
+ Tcl_ListObjAppendElement(interp, resultListPtr,
+ afterPtr->commandPtr);
+ Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
(afterPtr->token == NULL) ? "idle" : "timer", -1));
Tcl_SetObjResult(interp, resultListPtr);
- }
+ }
break;
default:
Tcl_Panic("Tcl_AfterObjCmd: bad subcommand index to afterSubCmds");