summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgeneric/tclArithSeries.c2
-rw-r--r--generic/tclBasic.c6
-rw-r--r--generic/tclCmdAH.c2
-rw-r--r--generic/tclCmdIL.c13
-rw-r--r--generic/tclCmdMZ.c8
-rw-r--r--generic/tclInt.h23
-rw-r--r--generic/tclOOCall.c4
-rw-r--r--generic/tclOODefineCmds.c8
-rw-r--r--generic/tclOOInfo.c4
-rw-r--r--generic/tclObj.c44
-rw-r--r--generic/tclPathObj.c2
-rw-r--r--generic/tclResult.c2
-rw-r--r--generic/tclScan.c3
-rw-r--r--generic/tclStringObj.c39
-rw-r--r--generic/tclZipfs.c2
-rw-r--r--unix/tclUnixChan.c2
-rw-r--r--win/tclWinChan.c2
17 files changed, 98 insertions, 68 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c
index 1019677..fcc5343 100755
--- a/generic/tclArithSeries.c
+++ b/generic/tclArithSeries.c
@@ -394,7 +394,7 @@ TclNewArithSeriesObj(
dstep = step;
}
if (dstep == 0) {
- *arithSeriesObj = Tcl_NewObj();
+ TclNewObj(*arithSeriesObj);
return TCL_OK;
}
}
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 20248a9..91c8d7a 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -805,7 +805,7 @@ Tcl_CreateInterp(void)
iPtr->legacyFreeProc = (void (*) (void))-1;
iPtr->errorLine = 0;
iPtr->stubTable = &tclStubs;
- iPtr->objResultPtr = Tcl_NewObj();
+ TclNewObj(iPtr->objResultPtr);
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
iPtr->globalNsPtr = NULL;
@@ -890,7 +890,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->threadId = Tcl_GetCurrentThread();
@@ -954,7 +954,7 @@ Tcl_CreateInterp(void)
* TIP #285, Script cancellation support.
*/
- iPtr->asyncCancelMsg = Tcl_NewObj();
+ TclNewObj(iPtr->asyncCancelMsg);
cancelInfo = (CancelInfo *)Tcl_Alloc(sizeof(CancelInfo));
cancelInfo->interp = interp;
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index cb71c40..bc8bf30 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -2325,7 +2325,7 @@ StoreStatData(
unsigned short mode;
if (varName == NULL) {
- result = Tcl_NewObj();
+ TclNewObj(result);
Tcl_IncrRefCount(result);
#define DOBJPUT(key, objValue) \
Tcl_DictObjPut(NULL, result, \
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 3fc1d2a..4836b9e 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -712,7 +712,7 @@ InfoCommandsCmd(
if (entryPtr != NULL) {
if (specificNsInPattern) {
cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr);
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
cmdName = (const char *)Tcl_GetHashKey(&nsPtr->cmdTable, entryPtr);
@@ -763,7 +763,7 @@ InfoCommandsCmd(
|| Tcl_StringMatch(cmdName, simplePattern)) {
if (specificNsInPattern) {
cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr);
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, cmd, elemObjPtr);
} else {
elemObjPtr = Tcl_NewStringObj(cmdName, -1);
@@ -990,7 +990,8 @@ InfoDefaultCmd(
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(1));
} else {
- Tcl_Obj *nullObjPtr = Tcl_NewObj();
+ Tcl_Obj *nullObjPtr;
+ TclNewObj(nullObjPtr);
valueObjPtr = Tcl_ObjSetVar2(interp, objv[3], NULL,
nullObjPtr, TCL_LEAVE_ERR_MSG);
@@ -1906,7 +1907,7 @@ InfoProcsCmd(
} else {
simpleProcOK:
if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
@@ -1934,7 +1935,7 @@ InfoProcsCmd(
} else {
procOK:
if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
+ TclNewObj(elemObjPtr);
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
elemObjPtr);
} else {
@@ -2252,7 +2253,7 @@ Tcl_JoinObjCmd(
} else {
Tcl_Size i;
- resObjPtr = Tcl_NewObj();
+ TclNewObj(resObjPtr);
if (isArithSeries) {
Tcl_Obj *valueObj;
for (i = 0; i < listLen; i++) {
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index a4e999c..77d8373 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) {
@@ -1194,7 +1194,7 @@ Tcl_SplitObjCmd(
stringPtr = Tcl_GetStringFromObj(objv[1], &stringLen);
end = stringPtr + stringLen;
- listPtr = Tcl_NewObj();
+ TclNewObj(listPtr);
if (stringLen == 0) {
/*
@@ -4701,7 +4701,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/tclInt.h b/generic/tclInt.h
index 497c3a5..0e7e497 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4542,7 +4542,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
/*
*----------------------------------------------------------------
- * Macro used by the Tcl core to set a Tcl_Obj's string representation to a
+ * Macros used by the Tcl core to set a Tcl_Obj's string representation to a
* copy of the "len" bytes starting at "bytePtr". The value of "len" must
* not be negative. When "len" is 0, then it is acceptable to pass
* "bytePtr" = NULL. When "len" > 0, "bytePtr" must not be NULL, and it
@@ -4555,17 +4555,22 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
* Because "len" is referenced multiple times, take care that it is an
* expression with the same value each use.
*
- * The ANSI C "prototype" for this macro is:
+ * The ANSI C "prototypes" for these macros are:
*
+ * MODULE_SCOPE void TclInitEmptyStringRep(Tcl_Obj *objPtr);
* MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, size_t len);
+ * MODULE_SCOPE void TclAttemptInitStringRep(Tcl_Obj *objPtr, char *bytePtr, size_t len);
*
*----------------------------------------------------------------
*/
+#define TclInitEmptyStringRep(objPtr) \
+ ((objPtr)->length = (((objPtr)->bytes = &tclEmptyString), 0))
+
+
#define TclInitStringRep(objPtr, bytePtr, len) \
if ((len) == 0) { \
- (objPtr)->bytes = &tclEmptyString; \
- (objPtr)->length = 0; \
+ TclInitEmptyStringRep(objPtr); \
} else { \
(objPtr)->bytes = (char *)Tcl_Alloc((len) + 1U); \
memcpy((objPtr)->bytes, (bytePtr) ? (bytePtr) : &tclEmptyString, (len)); \
@@ -4573,6 +4578,16 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
(objPtr)->length = (len); \
}
+#define TclAttemptInitStringRep(objPtr, bytePtr, len) \
+ ((((len) == 0) ? ( \
+ TclInitEmptyStringRep(objPtr) \
+ ) : ( \
+ (objPtr)->bytes = (char *)Tcl_AttemptAlloc((len) + 1U), \
+ memcpy((objPtr)->bytes, (bytePtr) ? (bytePtr) : &tclEmptyString, (len)), \
+ (objPtr)->bytes[len] = '\0', \
+ (objPtr)->length = (len) \
+ )), (objPtr)->bytes)
+
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to get the string representation's byte array
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index 39fd020..7695483 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -2255,7 +2255,7 @@ TclOOGetAllClassProperties(
*allocated = 1;
Tcl_InitObjHashTable(&hashTable);
FindClassProps(clsPtr, writable, &hashTable);
- result = Tcl_NewObj();
+ TclNewObj(result);
FOREACH_HASH(propName, dummy, &hashTable) {
Tcl_ListObjAppendElement(NULL, result, propName);
}
@@ -2337,7 +2337,7 @@ TclOOGetAllObjectProperties(
*allocated = 1;
Tcl_InitObjHashTable(&hashTable);
FindObjectProps(oPtr, writable, &hashTable);
- result = Tcl_NewObj();
+ TclNewObj(result);
FOREACH_HASH(propName, dummy, &hashTable) {
Tcl_ListObjAppendElement(NULL, result, propName);
}
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index a3bdddf..7a88ab7 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -3229,7 +3229,7 @@ ClassRPropsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(propNameObj, oPtr->classPtr->properties.readable) {
Tcl_ListObjAppendElement(NULL, resultObj, propNameObj);
}
@@ -3294,7 +3294,7 @@ ObjRPropsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(propNameObj, oPtr->properties.readable) {
Tcl_ListObjAppendElement(NULL, resultObj, propNameObj);
}
@@ -3426,7 +3426,7 @@ ClassWPropsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(propNameObj, oPtr->classPtr->properties.writable) {
Tcl_ListObjAppendElement(NULL, resultObj, propNameObj);
}
@@ -3491,7 +3491,7 @@ ObjWPropsGet(
return TCL_ERROR;
}
- resultObj = Tcl_NewObj();
+ TclNewObj(resultObj);
FOREACH(propNameObj, oPtr->properties.writable) {
Tcl_ListObjAppendElement(NULL, resultObj, propNameObj);
}
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index ab17a35..e71cddc 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -1787,7 +1787,7 @@ InfoClassPropCmd(
SortPropList(result);
}
} else {
- result = Tcl_NewObj();
+ TclNewObj(result);
if (writable) {
FOREACH(propObj, clsPtr->properties.writable) {
Tcl_ListObjAppendElement(NULL, result, propObj);
@@ -1850,7 +1850,7 @@ InfoObjectPropCmd(
SortPropList(result);
}
} else {
- result = Tcl_NewObj();
+ TclNewObj(result);
if (writable) {
FOREACH(propObj, oPtr->properties.writable) {
Tcl_ListObjAppendElement(NULL, result, propObj);
diff --git a/generic/tclObj.c b/generic/tclObj.c
index cd259ef..5c18f5e 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -999,7 +999,7 @@ TclDbDumpActiveObjects(
tablePtr = tsdPtr->objThreadMap;
if (tablePtr != NULL) {
- fprintf(outFile, "total objects: %" TCL_Z_MODIFIER "u\n", tablePtr->numEntries);
+ fprintf(outFile, "total objects: %" TCL_SIZE_MODIFIER "d\n", tablePtr->numEntries);
for (hPtr = Tcl_FirstHashEntry(tablePtr, &hSearch); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
ObjData *objData = (ObjData *)Tcl_GetHashValue(hPtr);
@@ -1053,7 +1053,7 @@ TclDbInitNewObj(
{
objPtr->refCount = 0;
objPtr->typePtr = NULL;
- TclInitStringRep(objPtr, NULL, 0);
+ TclInitEmptyStringRep(objPtr);
#if TCL_THREADS
/*
@@ -1195,7 +1195,9 @@ Tcl_DbNewObj(
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
- return Tcl_NewObj();
+ Tcl_Obj *objPtr;
+ TclNewObj(objPtr);
+ return objPtr;
}
#endif /* TCL_MEM_DEBUG */
@@ -1589,7 +1591,7 @@ Tcl_DuplicateObj(
/*
*----------------------------------------------------------------------
*
- * Tcl_DuplicatePureObj --
+ * TclDuplicatePureObj --
*
* Duplicates a Tcl_Obj and converts the internal representation of the
* duplicate to the given type, changing neither the 'bytes' field
@@ -1656,7 +1658,14 @@ int SetDuplicatePureObj(
|| typePtr == &tclStringType
)
) {
- TclInitStringRep(dupPtr, bytes, objPtr->length);
+ if (!TclAttemptInitStringRep(dupPtr, bytes, objPtr->length)) {
+ if (interp) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "insufficient memory to initialize string", -1));
+ Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
+ }
+ status = TCL_ERROR;
+ }
}
return status;
}
@@ -1915,7 +1924,7 @@ Tcl_InitStringRep(
if (objPtr->bytes == NULL) {
/* Start with no string rep */
if (numBytes == 0) {
- TclInitStringRep(objPtr, NULL, 0);
+ TclInitEmptyStringRep(objPtr);
return objPtr->bytes;
} else {
objPtr->bytes = (char *)Tcl_AttemptAlloc(numBytes + 1);
@@ -1942,7 +1951,7 @@ Tcl_InitStringRep(
/* Start with non-empty string rep (allocated) */
if (numBytes == 0) {
Tcl_Free(objPtr->bytes);
- TclInitStringRep(objPtr, NULL, 0);
+ TclInitEmptyStringRep(objPtr);
return objPtr->bytes;
} else {
objPtr->bytes = (char *)Tcl_AttemptRealloc(objPtr->bytes,
@@ -2010,8 +2019,9 @@ Tcl_HasStringRep(
* Called to set the object's internal representation to match a
* particular type.
*
- * It is the caller's resonsibility to ensure that the given IntRep is
- * appropriate for the existing string.
+ * It is the caller's responsibility to guarantee that
+ * the value of the submitted internalrep is in agreement with
+ * the value of any existing string rep.
*
* Results:
* None.
@@ -2027,16 +2037,14 @@ void
Tcl_StoreInternalRep(
Tcl_Obj *objPtr, /* Object whose internal rep should be set. */
const Tcl_ObjType *typePtr, /* New type for the object */
- const Tcl_ObjInternalRep *irPtr) /* New IntRep for the object */
+ const Tcl_ObjInternalRep *irPtr) /* New internalrep for the object */
{
- /* Clear out any existing IntRep. This is the point where shimmering, i.e.
- * repeated alteration of the type of the internal representation, may
- * occur. */
+ /* Clear out any existing internalrep ( "shimmer" ) */
TclFreeInternalRep(objPtr);
- /* When irPtr == NULL, just leave objPtr with no IntRep for typePtr */
+ /* When irPtr == NULL, just leave objPtr with no internalrep for typePtr */
if (irPtr) {
- /* Copy the new IntRep into place */
+ /* Copy the new internalrep into place */
objPtr->internalRep = *irPtr;
/* Set the type to match */
@@ -3507,7 +3515,7 @@ GetBignumFromObj(
* bignum values are converted to empty string.
*/
if (objPtr->bytes == NULL) {
- TclInitStringRep(objPtr, NULL, 0);
+ TclInitEmptyStringRep(objPtr);
}
}
return TCL_OK;
@@ -3871,7 +3879,7 @@ int
Tcl_IsShared(
Tcl_Obj *objPtr) /* The object to test for being shared. */
{
- return ((objPtr)->refCount + 1 > 2);
+ return ((objPtr)->refCount > 1);
}
/*
@@ -4314,7 +4322,7 @@ TclHashObjKey(
* See [tcl-Feature Request #2958832]
*/
- if (length) {
+ if (length > 0) {
result = UCHAR(*string);
while (--length) {
result += (result << 3) + UCHAR(*++string);
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index d7d8d33..33c9f77 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -2347,7 +2347,7 @@ UpdateStringOfFsPath(
/* Steal copy's string rep */
pathPtr->bytes = Tcl_GetStringFromObj(copy, &cwdLen);
pathPtr->length = cwdLen;
- TclInitStringRep(copy, NULL, 0);
+ TclInitEmptyStringRep(copy);
TclDecrRefCount(copy);
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index c06a73a..be8c2fd 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -495,7 +495,7 @@ Tcl_SetErrorCode(
*/
va_start(argList, interp);
- errorObj = Tcl_NewObj();
+ TclNewObj(errorObj);
/*
* Scan through the arguments one at a time, appending them to the
diff --git a/generic/tclScan.c b/generic/tclScan.c
index b7bd94a..bc2df17 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -1097,7 +1097,8 @@ Tcl_ScanObjCmd(
* We create an empty Tcl_Obj to fill missing values rather than
* allocating a new Tcl_Obj every time. See test scan-bigdata-XX.
*/
- Tcl_Obj *emptyObj = Tcl_NewObj();
+ Tcl_Obj *emptyObj;
+ TclNewObj(emptyObj);
Tcl_IncrRefCount(emptyObj);
TclNewObj(objPtr);
for (i = 0; code == TCL_OK && i < totalVars; i++) {
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index be807cd..2e42e98 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -610,7 +610,7 @@ Tcl_GetUniChar(
int
TclGetUniChar(
- Tcl_Obj *objPtr, /* The object to get the Unicode charater
+ Tcl_Obj *objPtr, /* The object to get the Unicode character
* from. */
Tcl_Size index) /* Get the index'th Unicode character. */
{
@@ -751,7 +751,7 @@ Tcl_GetRange(
Tcl_Size length = 0;
if (first < 0) {
- first = TCL_INDEX_START;
+ first = 0;
}
/*
@@ -1082,9 +1082,9 @@ Tcl_AttemptSetObjLength(
char *newBytes;
if (objPtr->bytes == &tclEmptyString) {
- newBytes = (char *)Tcl_AttemptAlloc(length + 1);
+ newBytes = (char *)Tcl_AttemptAlloc(length + 1U);
} else {
- newBytes = (char *)Tcl_AttemptRealloc(objPtr->bytes, length + 1);
+ newBytes = (char *)Tcl_AttemptRealloc(objPtr->bytes, length + 1U);
}
if (newBytes == NULL) {
return 0;
@@ -1289,7 +1289,7 @@ Tcl_AppendLimitedToObj(
Tcl_GetUnicode(objPtr);
stringPtr = GET_STRING(objPtr);
}
- if (stringPtr->hasUnicode && (stringPtr->numChars+1) > 1) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars) > 0) {
AppendUtfToUnicodeRep(objPtr, bytes, toCopy);
} else {
AppendUtfToUtfRep(objPtr, bytes, toCopy);
@@ -1300,7 +1300,7 @@ Tcl_AppendLimitedToObj(
}
stringPtr = GET_STRING(objPtr);
- if (stringPtr->hasUnicode && (stringPtr->numChars+1) > 1) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars) > 0) {
AppendUtfToUnicodeRep(objPtr, ellipsis, eLen);
} else {
AppendUtfToUtfRep(objPtr, ellipsis, eLen);
@@ -1949,7 +1949,7 @@ Tcl_AppendFormatToObj(
}
gotSequential = 1;
}
- if (objIndex < 0 || objIndex >= objc) {
+ if ((objIndex < 0) || (objIndex >= objc)) {
msg = badIndex[gotXpg];
errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH";
goto errorMsg;
@@ -2538,7 +2538,7 @@ Tcl_AppendFormatToObj(
goto errorMsg;
}
bytes = TclGetString(segment);
- if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, length, spec, d))) {
+ if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, segment->length, spec, d))) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
@@ -3095,7 +3095,6 @@ TclStringRepeat(
(count - done) * length);
}
return objResultPtr;
-
}
/*
@@ -3133,8 +3132,14 @@ TclStringCat(
/* assert ( objc >= 0 ) */
if (objc <= 1) {
- /* Negative (shouldn't be), one or no objects; return first or empty */
- return objc == 1 ? objv[0] : Tcl_NewObj();
+ if (objc != 1) {
+ /* Negative (shouldn't be) no objects; return empty */
+ Tcl_Obj *obj;
+ TclNewObj(obj);
+ return obj;
+ }
+ /* One object; return first */
+ return objv[0];
}
/* assert ( objc >= 2 ) */
@@ -3434,7 +3439,7 @@ TclStringCat(
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
+ "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes",
length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
@@ -3450,7 +3455,7 @@ TclStringCat(
Tcl_DecrRefCount(objResultPtr);
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes",
+ "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes",
length));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
@@ -3575,7 +3580,7 @@ TclStringCmp(
reqlength *= sizeof(Tcl_UniChar);
}
} else {
- memCmpFn = (memCmpFn_t) TclUniCharNcmp;
+ memCmpFn = (memCmpFn_t)(void *)TclUniCharNcmp;
}
}
}
@@ -3633,11 +3638,11 @@ TclStringCmp(
*/
if ((reqlength < 0) && !nocase) {
- memCmpFn = (memCmpFn_t) TclpUtfNcmp2;
+ memCmpFn = (memCmpFn_t)(void *)TclpUtfNcmp2;
} else {
s1len = Tcl_NumUtfChars(s1, s1len);
s2len = Tcl_NumUtfChars(s2, s2len);
- memCmpFn = (memCmpFn_t)
+ memCmpFn = (memCmpFn_t)(void *)
(nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp);
}
}
@@ -4426,7 +4431,7 @@ UpdateStringOfString(
stringPtr->allocated = 0;
if (stringPtr->numChars == 0) {
- TclInitStringRep(objPtr, NULL, 0);
+ TclInitEmptyStringRep(objPtr);
} else {
(void) ExtendStringRepWithUnicode(objPtr, stringPtr->unicode,
stringPtr->numChars);
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 48e7415..e9f7157 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -1902,7 +1902,7 @@ ListMountPoints(
return (ZipFS.zipHash.numEntries ? TCL_OK : TCL_BREAK);
}
- resultList = Tcl_NewObj();
+ TclNewObj(resultList);
for (hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); hPtr;
hPtr = Tcl_NextHashEntry(&search)) {
zf = (ZipFile *) Tcl_GetHashValue(hPtr);
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index c99c3fb..eea1453 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -618,7 +618,7 @@ StatOpenFile(
* duplicate!)
*/
- dictObj = Tcl_NewObj();
+ TclNewObj(dictObj);
#define STORE_ELEM(name, value) StoreElementInDict(dictObj, name, value)
STORE_ELEM("dev", Tcl_NewWideIntObj((long) statBuf.st_dev));
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 46fbd4b..9f541f0 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -864,7 +864,7 @@ StatOpenFile(
* We don't construct a Tcl_StatBuf; we're using the info immediately.
*/
- dictObj = Tcl_NewObj();
+ TclNewObj(dictObj);
#define STORE_ELEM(name, value) StoreElementInDict(dictObj, name, value)
STORE_ELEM("dev", Tcl_NewWideIntObj((long) dev));