summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-10-13 15:39:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-10-13 15:39:21 (GMT)
commitf1fa0053415509cd07e0d2b9f215203f6746101c (patch)
tree715b0805e459bc528019dbe3f056b7d6b1737c5b /generic
parent58e7b2f891498b711758a4be1b3483714b6c6a7e (diff)
parentb074d0c649e79b372e9cb7a57a5b7bf96703f34d (diff)
downloadtcl-f1fa0053415509cd07e0d2b9f215203f6746101c.zip
tcl-f1fa0053415509cd07e0d2b9f215203f6746101c.tar.gz
tcl-f1fa0053415509cd07e0d2b9f215203f6746101c.tar.bz2
merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c7
-rw-r--r--generic/tclCmdIL.c23
-rw-r--r--generic/tclCmdMZ.c11
-rw-r--r--generic/tclCompExpr.c4
-rw-r--r--generic/tclDate.c18
-rw-r--r--generic/tclDictObj.c3
-rw-r--r--generic/tclExecute.c8
-rw-r--r--generic/tclFCmd.c2
-rw-r--r--generic/tclGetDate.y18
-rw-r--r--generic/tclIORChan.c10
-rw-r--r--generic/tclListObj.c4
-rw-r--r--generic/tclLoad.c4
-rw-r--r--generic/tclMain.c7
-rw-r--r--generic/tclNamesp.c6
-rw-r--r--generic/tclOOBasic.c2
-rw-r--r--generic/tclPkg.c3
-rw-r--r--generic/tclScan.c12
-rw-r--r--generic/tclStringObj.c19
-rw-r--r--generic/tclTrace.c8
-rw-r--r--generic/tclUtil.c2
-rw-r--r--generic/tclVar.c9
-rw-r--r--generic/tclZlib.c5
22 files changed, 100 insertions, 85 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index d154bcf..2f8ab29 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -803,7 +803,7 @@ TclNRAssembleObjCmd(
Tcl_AddErrorInfo(interp, "\n (\"");
Tcl_AppendObjToErrorInfo(interp, objv[0]);
Tcl_AddErrorInfo(interp, "\" body, line ");
- backtrace = Tcl_NewIntObj(Tcl_GetErrorLine(interp));
+ TclNewIntObj(backtrace, Tcl_GetErrorLine(interp));
Tcl_AppendObjToErrorInfo(interp, backtrace);
Tcl_AddErrorInfo(interp, ")");
return TCL_ERROR;
@@ -2089,8 +2089,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) {
@@ -4260,7 +4261,7 @@ AddBasicBlockRangeToErrorInfo(
Tcl_Obj* lineNo; /* Line number in the source */
Tcl_AddErrorInfo(interp, "\n in assembly code between lines ");
- lineNo = Tcl_NewIntObj(bbPtr->startLine);
+ TclNewIntObj(lineNo, bbPtr->startLine);
Tcl_IncrRefCount(lineNo);
Tcl_AppendObjToErrorInfo(interp, lineNo);
Tcl_AddErrorInfo(interp, " and ");
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 8ecd145..c662c22 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -401,7 +401,7 @@ Tcl_IncrObjCmd(
if (objc == 3) {
incrPtr = objv[2];
} else {
- incrPtr = Tcl_NewIntObj(1);
+ TclNewIntObj(incrPtr, 1);
}
Tcl_IncrRefCount(incrPtr);
newValuePtr = TclIncrObjVar2(interp, objv[1], NULL,
@@ -719,7 +719,7 @@ InfoCommandsCmd(
if (entryPtr != NULL) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
@@ -770,7 +770,7 @@ InfoCommandsCmd(
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (specificNsInPattern) {
cmd = Tcl_GetHashValue(entryPtr);
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
@@ -997,8 +997,9 @@ InfoDefaultCmd(
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
} else {
- Tcl_Obj *nullObjPtr = Tcl_NewObj();
+ Tcl_Obj *nullObjPtr;
+ TclNewObj(nullObjPtr);
valueObjPtr = Tcl_ObjSetVar2(interp, objv[3], NULL,
nullObjPtr, TCL_LEAVE_ERR_MSG);
if (valueObjPtr == NULL) {
@@ -1908,7 +1909,7 @@ InfoProcsCmd(
} else {
simpleProcOK:
if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
@@ -1936,7 +1937,7 @@ InfoProcsCmd(
} else {
procOK:
if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
@@ -2169,7 +2170,7 @@ Tcl_JoinObjCmd(
joinObjPtr = (objc == 2) ? Tcl_NewStringObj(" ", 1) : objv[2];
Tcl_IncrRefCount(joinObjPtr);
- resObjPtr = Tcl_NewObj();
+ TclNewObj(resObjPtr);
for (i = 0; i < listLen; i++) {
if (i > 0) {
@@ -3485,7 +3486,7 @@ Tcl_LsearchObjCmd(
} else if (returnSubindices) {
int j;
- itemPtr = Tcl_NewIntObj(i);
+ TclNewIntObj(itemPtr, i);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_ListObjAppendElement(interp, itemPtr, Tcl_NewIntObj(
TclIndexDecode(sortInfo.indexv[j], listc)));
@@ -3507,7 +3508,7 @@ Tcl_LsearchObjCmd(
if (returnSubindices) {
int j;
- itemPtr = Tcl_NewIntObj(index);
+ TclNewIntObj(itemPtr, index);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_ListObjAppendElement(interp, itemPtr, Tcl_NewIntObj(
TclIndexDecode(sortInfo.indexv[j], listc)));
@@ -4087,7 +4088,7 @@ Tcl_LsortObjCmd(
idx = elementPtr->payload.index;
for (j = 0; j < groupSize; j++) {
if (indices) {
- objPtr = Tcl_NewIntObj(idx + j - groupOffset);
+ TclNewIntObj(objPtr, idx + j - groupOffset);
newArray[i++] = objPtr;
Tcl_IncrRefCount(objPtr);
} else {
@@ -4099,7 +4100,7 @@ Tcl_LsortObjCmd(
}
} else if (indices) {
for (i=0; elementPtr != NULL ; elementPtr = elementPtr->nextPtr) {
- objPtr = Tcl_NewIntObj(elementPtr->payload.index);
+ TclNewIntObj(objPtr, elementPtr->payload.index);
newArray[i++] = objPtr;
Tcl_IncrRefCount(objPtr);
}
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index b24cb97..081b036 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -357,7 +357,7 @@ Tcl_RegexpObjCmd(
objc = info.nsubs + 1;
if (all <= 1) {
- resultPtr = Tcl_NewObj();
+ TclNewObj(resultPtr);
}
}
for (i = 0; i < objc; i++) {
@@ -399,7 +399,7 @@ Tcl_RegexpObjCmd(
offset + info.matches[i].start,
offset + info.matches[i].end - 1);
} else {
- newPtr = Tcl_NewObj();
+ TclNewObj(newPtr);
}
}
if (doinline) {
@@ -1058,7 +1058,7 @@ Tcl_SplitObjCmd(
stringPtr = TclGetStringFromObj(objv[1], &stringLen);
end = stringPtr + stringLen;
- listPtr = Tcl_NewObj();
+ TclNewObj(listPtr);
if (stringLen == 0) {
/*
@@ -3915,7 +3915,8 @@ TclNRSwitchObjCmd(
rangeObjAry[0] = Tcl_NewLongObj(info.matches[j].start);
rangeObjAry[1] = Tcl_NewLongObj(info.matches[j].end-1);
} else {
- rangeObjAry[0] = rangeObjAry[1] = Tcl_NewIntObj(-1);
+ TclNewIntObj(rangeObjAry[1], -1);
+ rangeObjAry[0] = rangeObjAry[1];
}
/*
@@ -4857,7 +4858,7 @@ TclNRTryObjCmd(
return TCL_ERROR;
}
bodyObj = objv[1];
- handlersObj = Tcl_NewObj();
+ TclNewObj(handlersObj);
bodyShared = 0;
haveHandlers = 0;
for (i=2 ; i<objc ; i++) {
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 729ad52..1ffe099 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2689,7 +2689,7 @@ TclVariadicOpCmd(
Tcl_Obj *const *litObjPtrPtr = litObjv;
if (lexeme == EXPON) {
- litObjv[1] = Tcl_NewIntObj(occdPtr->i.identity);
+ TclNewIntObj(litObjv[1], occdPtr->i.identity);
Tcl_IncrRefCount(litObjv[1]);
decrMe = 1;
litObjv[0] = objv[1];
@@ -2705,7 +2705,7 @@ TclVariadicOpCmd(
if (lexeme == DIVIDE) {
litObjv[0] = Tcl_NewDoubleObj(1.0);
} else {
- litObjv[0] = Tcl_NewIntObj(occdPtr->i.identity);
+ TclNewIntObj(litObjv[0], occdPtr->i.identity);
}
Tcl_IncrRefCount(litObjv[0]);
litObjv[1] = objv[1];
diff --git a/generic/tclDate.c b/generic/tclDate.c
index 5410046..90650ef 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -2501,12 +2501,12 @@ TclDateerror(
Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1);
Tcl_AppendToObj(infoPtr->messages, s, -1);
Tcl_AppendToObj(infoPtr->messages, " (characters ", -1);
- t = Tcl_NewIntObj(location->first_column);
+ TclNewIntObj(t, location->first_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
Tcl_AppendToObj(infoPtr->messages, "-", -1);
- t = Tcl_NewIntObj(location->last_column);
+ TclNewIntObj(t, location->last_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
@@ -2788,7 +2788,7 @@ TclClockOldscanObjCmd(
yyHaveRel = 0;
yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL;
- dateInfo.messages = Tcl_NewObj();
+ TclNewObj(dateInfo.messages);
dateInfo.separatrix = "";
Tcl_IncrRefCount(dateInfo.messages);
@@ -2845,8 +2845,8 @@ TclClockOldscanObjCmd(
return TCL_ERROR;
}
- result = Tcl_NewObj();
- resultElement = Tcl_NewObj();
+ TclNewObj(result);
+ TclNewObj(resultElement);
if (yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyYear));
@@ -2864,7 +2864,7 @@ TclClockOldscanObjCmd(
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
}
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveZone) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) -yyTimezone));
@@ -2873,7 +2873,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveRel) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyRelMonth));
@@ -2884,7 +2884,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveDay && !yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyDayOrdinal));
@@ -2893,7 +2893,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveOrdinalMonth) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyMonthOrdinal));
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index a42c123..becc029 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -2142,8 +2142,9 @@ DictIncrCmd(
if (objc == 4) {
code = TclIncrObj(interp, valuePtr, objv[3]);
} else {
- Tcl_Obj *incrPtr = Tcl_NewIntObj(1);
+ Tcl_Obj *incrPtr;
+ TclNewIntObj(incrPtr, 1);
Tcl_IncrRefCount(incrPtr);
code = TclIncrObj(interp, valuePtr, incrPtr);
TclDecrRefCount(incrPtr);
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index b8e9312..0a293bd 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -3854,7 +3854,7 @@ TEBCresume(
case INST_INCR_SCALAR_STK_IMM:
case INST_INCR_STK_IMM:
increment = TclGetInt1AtPtr(pc+1);
- incrPtr = Tcl_NewIntObj(increment);
+ TclNewIntObj(incrPtr, increment);
Tcl_IncrRefCount(incrPtr);
pcAdjustment = 2;
@@ -3889,7 +3889,7 @@ TEBCresume(
case INST_INCR_ARRAY1_IMM:
opnd = TclGetUInt1AtPtr(pc+1);
increment = TclGetInt1AtPtr(pc+2);
- incrPtr = Tcl_NewIntObj(increment);
+ TclNewIntObj(incrPtr, increment);
Tcl_IncrRefCount(incrPtr);
pcAdjustment = 3;
@@ -7394,7 +7394,7 @@ TEBCresume(
if (valuePtr == NULL) {
Tcl_DictObjPut(NULL, dictPtr, OBJ_AT_TOS,Tcl_NewIntObj(opnd));
} else {
- value2Ptr = Tcl_NewIntObj(opnd);
+ TclNewIntObj(value2Ptr, opnd);
Tcl_IncrRefCount(value2Ptr);
if (Tcl_IsShared(valuePtr)) {
valuePtr = Tcl_DuplicateObj(valuePtr);
@@ -10248,7 +10248,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 99372c5..e2d4164 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/tclGetDate.y b/generic/tclGetDate.y
index 86037d6..65a3f86 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -716,12 +716,12 @@ TclDateerror(
Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1);
Tcl_AppendToObj(infoPtr->messages, s, -1);
Tcl_AppendToObj(infoPtr->messages, " (characters ", -1);
- t = Tcl_NewIntObj(location->first_column);
+ TclNewIntObj(t, location->first_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
Tcl_AppendToObj(infoPtr->messages, "-", -1);
- t = Tcl_NewIntObj(location->last_column);
+ TclNewIntObj(t, location->last_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
@@ -1003,7 +1003,7 @@ TclClockOldscanObjCmd(
yyHaveRel = 0;
yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL;
- dateInfo.messages = Tcl_NewObj();
+ TclNewObj(dateInfo.messages);
dateInfo.separatrix = "";
Tcl_IncrRefCount(dateInfo.messages);
@@ -1060,8 +1060,8 @@ TclClockOldscanObjCmd(
return TCL_ERROR;
}
- result = Tcl_NewObj();
- resultElement = Tcl_NewObj();
+ TclNewObj(result);
+ TclNewObj(resultElement);
if (yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyYear));
@@ -1079,7 +1079,7 @@ TclClockOldscanObjCmd(
Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
}
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveZone) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) -yyTimezone));
@@ -1088,7 +1088,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveRel) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyRelMonth));
@@ -1099,7 +1099,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TcNewObj(resultElement);
if (yyHaveDay && !yyHaveDate) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyDayOrdinal));
@@ -1108,7 +1108,7 @@ TclClockOldscanObjCmd(
}
Tcl_ListObjAppendElement(interp, result, resultElement);
- resultElement = Tcl_NewObj();
+ TclNewObj(resultElement);
if (yyHaveOrdinalMonth) {
Tcl_ListObjAppendElement(interp, resultElement,
Tcl_NewIntObj((int) yyMonthOrdinal));
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 9969b87..dd24b0f 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -1318,7 +1318,7 @@ ReflectInput(
Tcl_Preserve(rcPtr);
- toReadObj = Tcl_NewIntObj(toRead);
+ TclNewIntObj(toReadObj, toRead);
Tcl_IncrRefCount(toReadObj);
if (InvokeTclMethod(rcPtr, METH_READ, toReadObj, NULL, &resObj)!=TCL_OK) {
@@ -2999,10 +2999,12 @@ ForwardProc(
}
case ForwardedInput: {
- Tcl_Obj *toReadObj = Tcl_NewIntObj(paramPtr->input.toRead);
- Tcl_IncrRefCount(toReadObj);
+ Tcl_Obj *toReadObj;
- Tcl_Preserve(rcPtr);
+ TclNewIntObj(toReadObj, paramPtr->input.toRead);
+ Tcl_IncrRefCount(toReadObj);
+
+ Tcl_Preserve(rcPtr);
if (InvokeTclMethod(rcPtr, METH_READ, toReadObj, NULL, &resObj)!=TCL_OK){
int code = ErrnoReturn(rcPtr, resObj);
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 481cae7..11726d5 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -1227,7 +1227,7 @@ TclLindexFlat(
return NULL;
}
}
- listPtr = Tcl_NewObj();
+ TclNewObj(listPtr);
} else {
/*
* Extract the pointer to the appropriate element.
@@ -1458,7 +1458,7 @@ TclLsetFlat(
if (--indexCount) {
parentList = subListPtr;
if (index == elemCount) {
- subListPtr = Tcl_NewObj();
+ TclNewObj(subListPtr);
} else {
subListPtr = elemPtrs[index];
}
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 5a736de..9ca2e7a 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -1049,7 +1049,7 @@ TclGetLoadedPackages(
* Return information about all of the available packages.
*/
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
Tcl_MutexLock(&packageMutex);
for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
pkgPtr = pkgPtr->nextPtr) {
@@ -1073,7 +1073,7 @@ TclGetLoadedPackages(
return TCL_ERROR;
}
ipPtr = Tcl_GetAssocData(target, "tclLoad", NULL);
- 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 cef4543..f0b2682 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -306,7 +306,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
@@ -521,7 +521,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);
@@ -805,7 +805,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 bfce6ee..9541828 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -3547,8 +3547,9 @@ NamespaceExportCmd(
*/
if (objc == 1) {
- Tcl_Obj *listPtr = Tcl_NewObj();
+ Tcl_Obj *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(
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index d874cba..0a1e1eb 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -1155,7 +1155,7 @@ TclOOSelfObjCmd(
}
case SELF_CALL:
result[0] = TclOORenderCallChain(interp, contextPtr->callPtr);
- result[1] = Tcl_NewIntObj(contextPtr->index);
+ TclNewIntObj(result[1], contextPtr->index);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
return TCL_OK;
}
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 0a0c868..2150c31 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -718,8 +718,9 @@ SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) {
}
}
} else if (result != TCL_ERROR) {
- Tcl_Obj *codePtr = Tcl_NewIntObj(result);
+ Tcl_Obj *codePtr;
+ TclNewIntObj(codePtr, result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"attempt to provide package %s %s failed:"
" bad return code: %s",
diff --git a/generic/tclScan.c b/generic/tclScan.c
index c599797..6ab17bd 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -721,7 +721,7 @@ Tcl_ScanObjCmd(
switch (ch) {
case 'n':
if (!(flags & SCAN_SUPPRESS)) {
- objPtr = Tcl_NewIntObj(string - baseString);
+ TclNewIntObj(objPtr, string - baseString);
Tcl_IncrRefCount(objPtr);
CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
@@ -884,7 +884,7 @@ Tcl_ScanObjCmd(
offset = TclUtfToUCS4(string, &i);
string += offset;
if (!(flags & SCAN_SUPPRESS)) {
- objPtr = Tcl_NewIntObj(i);
+ TclNewIntObj(objPtr, i);
Tcl_IncrRefCount(objPtr);
CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
@@ -1035,7 +1035,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]);
@@ -1056,16 +1056,16 @@ Tcl_ScanObjCmd(
if (code == TCL_OK) {
if (underflow && (nconversions == 0)) {
if (numVars) {
- objPtr = Tcl_NewIntObj(-1);
+ TclNewIntObj(objPtr, -1);
} else {
if (objPtr) {
Tcl_SetListObj(objPtr, 0, NULL);
} else {
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
}
}
} else if (numVars) {
- objPtr = Tcl_NewIntObj(result);
+ TclNewIntObj(objPtr, result);
}
Tcl_SetObjResult(interp, objPtr);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 656d6ce..33b2139 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2209,7 +2209,7 @@ Tcl_AppendFormatToObj(
isNegative = (l < (long) 0);
}
- segment = Tcl_NewObj();
+ TclNewObj(segment);
allocSegment = 1;
segmentLimit = INT_MAX;
Tcl_IncrRefCount(segment);
@@ -2249,7 +2249,7 @@ Tcl_AppendFormatToObj(
const char *bytes;
if (useShort) {
- pure = Tcl_NewIntObj((int) s);
+ TclNewIntObj(pure, (int) s);
#ifndef TCL_WIDE_INT_IS_LONG
} else if (useWide) {
pure = Tcl_NewWideIntObj(w);
@@ -2378,7 +2378,7 @@ Tcl_AppendFormatToObj(
if ((numDigits == 0) && !((ch == 'o') && gotHash)) {
numDigits = 1;
}
- pure = Tcl_NewObj();
+ TclNewObj(pure);
Tcl_SetObjLength(pure, (int) numDigits);
bytes = TclGetString(pure);
toAppend = length = (int) numDigits;
@@ -2497,7 +2497,7 @@ Tcl_AppendFormatToObj(
*p++ = (char) ch;
*p = '\0';
- segment = Tcl_NewObj();
+ TclNewObj(segment);
allocSegment = 1;
if (!Tcl_AttemptSetObjLength(segment, length)) {
msg = overflow;
@@ -2605,8 +2605,9 @@ Tcl_Format(
Tcl_Obj *const objv[])
{
int result;
- Tcl_Obj *objPtr = Tcl_NewObj();
+ Tcl_Obj *objPtr;
+ TclNewObj(objPtr);
result = Tcl_AppendFormatToObj(interp, objPtr, format, objc, objv);
if (result != TCL_OK) {
Tcl_DecrRefCount(objPtr);
@@ -2634,9 +2635,10 @@ AppendPrintfToObjVA(
va_list argList)
{
int code, objc;
- Tcl_Obj **objv, *list = Tcl_NewObj();
+ Tcl_Obj **objv, *list;
const char *p;
+ TclNewObj(list);
p = format;
Tcl_IncrRefCount(list);
while (*p != '\0') {
@@ -2808,8 +2810,9 @@ Tcl_ObjPrintf(
...)
{
va_list argList;
- Tcl_Obj *objPtr = Tcl_NewObj();
+ Tcl_Obj *objPtr;
+ TclNewObj(objPtr);
va_start(argList, format);
AppendPrintfToObjVA(objPtr, format, argList);
va_end(argList);
@@ -2948,7 +2951,7 @@ TclStringReverse(
char *to, *from = objPtr->bytes;
if (Tcl_IsShared(objPtr)) {
- objPtr = Tcl_NewObj();
+ TclNewObj(objPtr);
Tcl_SetObjLength(objPtr, numBytes);
}
to = objPtr->bytes;
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 0228aff..c82fc14 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -278,7 +278,7 @@ Tcl_TraceObjCmd(
return TCL_ERROR;
}
- opsList = Tcl_NewObj();
+ TclNewObj(opsList);
Tcl_IncrRefCount(opsList);
flagOps = Tcl_GetStringFromObj(objv[3], &numFlags);
if (numFlags == 0) {
@@ -322,7 +322,7 @@ Tcl_TraceObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "name");
return TCL_ERROR;
}
- resultListPtr = Tcl_NewObj();
+ TclNewObj(resultListPtr);
name = Tcl_GetString(objv[2]);
FOREACH_VAR_TRACE(interp, name, clientData) {
TraceVarInfo *tvarPtr = clientData;
@@ -967,7 +967,7 @@ TraceVariableObjCmd(
return TCL_ERROR;
}
- resultListPtr = Tcl_NewObj();
+ TclNewObj(resultListPtr);
name = Tcl_GetString(objv[3]);
FOREACH_VAR_TRACE(interp, name, clientData) {
Tcl_Obj *opObjPtr, *eachTraceObjPtr, *elemObjPtr;
@@ -1852,7 +1852,7 @@ TraceExecutionProc(
* Append result code.
*/
- resultCode = Tcl_NewIntObj(code);
+ TclNewIntObj(resultCode, code);
resultCodeStr = Tcl_GetString(resultCode);
Tcl_DStringAppendElement(&cmd, resultCodeStr);
Tcl_DecrRefCount(resultCode);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 9efdbc3..d7baedd 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -2036,7 +2036,7 @@ Tcl_ConcatObj(
}
}
if (!resPtr) {
- resPtr = Tcl_NewObj();
+ TclNewObj(resPtr);
}
return resPtr;
}
diff --git a/generic/tclVar.c b/generic/tclVar.c
index b7567a8..566e543 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -2216,7 +2216,7 @@ TclPtrIncrObjVarIdx(
VarHashRefCount(varPtr)--;
}
if (varValuePtr == NULL) {
- varValuePtr = Tcl_NewIntObj(0);
+ TclNewIntObj(varValuePtr, 0);
}
if (Tcl_IsShared(varValuePtr)) {
/* Copy on write */
@@ -5140,7 +5140,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);
@@ -5875,7 +5876,7 @@ TclInfoVarsCmd(
if (!TclIsVarUndefined(varPtr)
|| TclIsVarNamespaceVar(varPtr)) {
if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr,
elemObjPtr);
} else {
@@ -5908,7 +5909,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/tclZlib.c b/generic/tclZlib.c
index bdda9bc..ac19449 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2133,7 +2133,7 @@ ZlibCmd(
break;
case 1:
headerVarObj = objv[i+1];
- headerDictObj = Tcl_NewObj();
+ TclNewObj(headerDictObj);
break;
}
}
@@ -3432,8 +3432,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");