summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-10-06 00:24:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-10-06 00:24:14 (GMT)
commitaa7af790fd920113d69eab504fe4ea31d672fd08 (patch)
tree3df457aa5b5852d4833c2649d5482af83b9bafc6 /generic
parent120ce535474dc17d51d505e3aa8d4202dde2c81b (diff)
downloadtcl-aa7af790fd920113d69eab504fe4ea31d672fd08.zip
tcl-aa7af790fd920113d69eab504fe4ea31d672fd08.tar.gz
tcl-aa7af790fd920113d69eab504fe4ea31d672fd08.tar.bz2
* generic/tclBasic.c:
* generic/tclBinary.c: * generic/tclCmdAH.c: It is a poor practice to directly set or append to the value of the objResult of an interp, because that value might be shared, and in that circumstance a Tcl_Panic() will be the result. Searched for example of this practice and replaced with safer alternatives, often using the Tcl_AppendResult() routine that dkf just rehabilitated.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c88
-rw-r--r--generic/tclBinary.c10
-rw-r--r--generic/tclCmdAH.c85
3 files changed, 76 insertions, 107 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 7cd40db..5e410d4 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.124 2004/10/05 21:21:45 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.125 2004/10/06 00:24:16 dgp Exp $
*/
#include "tclInt.h"
@@ -1090,7 +1090,7 @@ Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ Tcl_AppendResult(interp,
"cannot use namespace qualifiers in hidden command",
" token (rename)", (char *) NULL);
return TCL_ERROR;
@@ -1114,8 +1114,7 @@ Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
*/
if ( cmdPtr->nsPtr != iPtr->globalNsPtr ) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can only hide global namespace commands",
+ Tcl_AppendResult(interp, "can only hide global namespace commands",
" (use rename then hide)", (char *) NULL);
return TCL_ERROR;
}
@@ -1140,9 +1139,8 @@ Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
hPtr = Tcl_CreateHashEntry(hiddenCmdTablePtr, hiddenCmdToken, &new);
if (!new) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "hidden command named \"", hiddenCmdToken, "\" already exists",
- (char *) NULL);
+ Tcl_AppendResult(interp, "hidden command named \"", hiddenCmdToken,
+ "\" already exists", (char *) NULL);
return TCL_ERROR;
}
@@ -1244,10 +1242,8 @@ Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
*/
if (strstr(cmdName, "::") != NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can not expose to a namespace ",
- "(use expose to toplevel, then rename)",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can not expose to a namespace ",
+ "(use expose to toplevel, then rename)", (char *) NULL);
return TCL_ERROR;
}
@@ -1261,8 +1257,7 @@ Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
hPtr = Tcl_FindHashEntry(hiddenCmdTablePtr, hiddenCmdToken);
}
if (hPtr == (Tcl_HashEntry *) NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "unknown hidden command \"", hiddenCmdToken,
+ Tcl_AppendResult(interp, "unknown hidden command \"", hiddenCmdToken,
"\"", (char *) NULL);
return TCL_ERROR;
}
@@ -1280,7 +1275,7 @@ Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
* This case is theoritically impossible,
* we might rather Tcl_Panic() than 'nicely' erroring out ?
*/
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ Tcl_AppendResult(interp,
"trying to expose a non global command name space command",
(char *) NULL);
return TCL_ERROR;
@@ -1296,8 +1291,7 @@ Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, cmdName, &new);
if (!new) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "exposed command \"", cmdName,
+ Tcl_AppendResult(interp, "exposed command \"", cmdName,
"\" already exists", (char *) NULL);
return TCL_ERROR;
}
@@ -1818,8 +1812,7 @@ TclInvokeObjectCommand(clientData, interp, argc, argv)
* then reset the object result.
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
/*
* Decrement the ref counts for the argument objects created above,
@@ -1886,7 +1879,7 @@ TclRenameCommand(interp, oldName, newName)
/*flags*/ 0);
cmdPtr = (Command *) cmd;
if (cmdPtr == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't ",
+ Tcl_AppendResult(interp, "can't ",
((newName == NULL)||(*newName == '\0'))? "delete":"rename",
" \"", oldName, "\": command doesn't exist", (char *) NULL);
return TCL_ERROR;
@@ -1918,15 +1911,13 @@ TclRenameCommand(interp, oldName, newName)
TCL_CREATE_NS_IF_UNKNOWN, &newNsPtr, &dummy1, &dummy2, &newTail);
if ((newNsPtr == NULL) || (newTail == NULL)) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can't rename to \"", newName, "\": bad command name",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't rename to \"", newName,
+ "\": bad command name", (char *) NULL);
result = TCL_ERROR;
goto done;
}
if (Tcl_FindHashEntry(&newNsPtr->cmdTable, newTail) != NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can't rename to \"", newName,
+ Tcl_AppendResult(interp, "can't rename to \"", newName,
"\": command already exists", (char *) NULL);
result = TCL_ERROR;
goto done;
@@ -2769,9 +2760,8 @@ Tcl_GetMathFuncInfo(interp, name, numArgsPtr, argTypesPtr, procPtr,
hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, name);
if (hPtr == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "math function \"", name, "\" not known in this interpreter",
- (char *) NULL);
+ Tcl_AppendResult(interp, "math function \"", name,
+ "\" not known in this interpreter", (char *) NULL);
return TCL_ERROR;
}
mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr);
@@ -2879,8 +2869,8 @@ TclInterpReady(interp)
if (iPtr->flags & DELETED) {
Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "attempt to call eval in deleted interpreter", -1);
+ Tcl_AppendResult(interp,
+ "attempt to call eval in deleted interpreter", (char *) NULL);
Tcl_SetErrorCode(interp, "CORE", "IDELETE",
"attempt to call eval in deleted interpreter",
(char *) NULL);
@@ -2894,8 +2884,8 @@ TclInterpReady(interp)
if (((iPtr->numLevels) > iPtr->maxNestingDepth)
|| (TclpCheckStackSpace() == 0)) {
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "too many nested evaluations (infinite loop?)", -1);
+ Tcl_AppendResult(interp,
+ "too many nested evaluations (infinite loop?)", (char *) NULL);
return TCL_ERROR;
}
@@ -3000,9 +2990,8 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
Tcl_IncrRefCount(newObjv[0]);
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, newObjv[0]);
if (cmdPtr == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "invalid command name \"", Tcl_GetString(objv[0]), "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "invalid command name \"",
+ Tcl_GetString(objv[0]), "\"", (char *) NULL);
code = TCL_ERROR;
} else {
iPtr->numLevels++;
@@ -3690,8 +3679,7 @@ Tcl_Eval(interp, string)
* back into the string result (some callers may expect it there).
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
return code;
}
@@ -3863,11 +3851,11 @@ ProcessUnexpectedResult(interp, returnCode)
{
Tcl_ResetResult(interp);
if (returnCode == TCL_BREAK) {
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "invoked \"break\" outside of a loop", -1);
+ Tcl_AppendResult(interp,
+ "invoked \"break\" outside of a loop", (char *) NULL);
} else if (returnCode == TCL_CONTINUE) {
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "invoked \"continue\" outside of a loop", -1);
+ Tcl_AppendResult(interp,
+ "invoked \"continue\" outside of a loop", (char *) NULL);
} else {
char buf[30 + TCL_INTEGER_SPACE];
@@ -3934,8 +3922,7 @@ Tcl_ExprLong(interp, string, ptr)
* then reset the object result.
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
@@ -3985,8 +3972,7 @@ Tcl_ExprDouble(interp, string, ptr)
* then reset the object result.
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
@@ -4035,8 +4021,7 @@ Tcl_ExprBoolean(interp, string, ptr)
* then reset the object result.
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
@@ -4243,8 +4228,7 @@ TclObjInvoke(interp, objc, objv, flags)
}
if ((objc < 1) || (objv == (Tcl_Obj **) NULL)) {
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "illegal argument vector", -1);
+ Tcl_AppendResult(interp, "illegal argument vector", (char *) NULL);
return TCL_ERROR;
}
@@ -4262,9 +4246,8 @@ TclObjInvoke(interp, objc, objv, flags)
hPtr = Tcl_FindHashEntry(hTblPtr, cmdName);
}
if (hPtr == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "invalid hidden command name \"", cmdName, "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "invalid hidden command name \"",
+ cmdName, "\"", (char *) NULL);
return TCL_ERROR;
}
cmdPtr = (Command *) Tcl_GetHashValue(hPtr);
@@ -4358,8 +4341,7 @@ Tcl_ExprString(interp, string)
* then reset the object result.
*/
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
+ (void) Tcl_GetStringResult(interp);
}
Tcl_DecrRefCount(exprPtr); /* discard the expression object */
} else {
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 28f83ad..faa317e 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBinary.c,v 1.19 2004/09/29 22:17:33 dkf Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.20 2004/10/06 00:24:16 dgp Exp $
*/
#include "tclInt.h"
@@ -774,7 +774,7 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv)
* number of bytes and filling with nulls.
*/
- resultPtr = Tcl_GetObjResult(interp);
+ resultPtr = Tcl_NewObj();
buffer = Tcl_SetByteArrayLength(resultPtr, length);
memset((VOID *) buffer, 0, (size_t) length);
@@ -1033,6 +1033,7 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv)
}
}
}
+ Tcl_SetObjResult(interp, resultPtr);
break;
}
case BINARY_SCAN: {
@@ -1342,8 +1343,7 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv)
*/
done:
- Tcl_ResetResult(interp);
- Tcl_SetLongObj(Tcl_GetObjResult(interp), arg - 4);
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(arg - 4));
DeleteScanNumberCache(numberCachePtr);
break;
}
@@ -1352,7 +1352,7 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv)
badValue:
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "expected ", errorString,
+ Tcl_AppendResult(interp, "expected ", errorString,
" string but got \"", errorValue, "\" instead", NULL);
return TCL_ERROR;
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 6208c93..6cdb252 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.51 2004/10/05 18:14:27 dgp Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.52 2004/10/06 00:24:16 dgp Exp $
*/
#include "tclInt.h"
@@ -135,8 +135,7 @@ Tcl_CaseObjCmd(dummy, interp, objc, objv)
if (i == (caseObjc - 1)) {
Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "extra case pattern with no body", -1);
+ Tcl_AppendResult(interp, "extra case pattern with no body", NULL);
return TCL_ERROR;
}
@@ -266,8 +265,8 @@ Tcl_CatchObjCmd(dummy, interp, objc, objv)
if (NULL == Tcl_ObjSetVar2(interp, varNamePtr, NULL,
Tcl_GetObjResult(interp), 0)) {
Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "couldn't save command result in variable", -1);
+ Tcl_AppendResult(interp,
+ "couldn't save command result in variable", NULL);
return TCL_ERROR;
}
}
@@ -312,21 +311,14 @@ Tcl_CatchObjCmd(dummy, interp, objc, objv)
Tcl_ObjSetVar2(interp, optionVarNamePtr, NULL, options, 0)) {
Tcl_DecrRefCount(options);
Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "couldn't save return options in variable", -1);
+ Tcl_AppendResult(interp,
+ "couldn't save return options in variable", NULL);
return TCL_ERROR;
}
}
- /*
- * Set the interpreter's object result to an integer object holding the
- * integer Tcl_EvalObj result. Note that we don't bother generating a
- * string representation. We reset the interpreter's object result
- * to an unshared empty object and then set it to be an integer object.
- */
-
Tcl_ResetResult(interp);
- Tcl_SetIntObj(Tcl_GetObjResult(interp), result);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
return TCL_OK;
}
@@ -479,7 +471,6 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
Tcl_Encoding encoding;
char *string;
Tcl_DString ds;
- Tcl_Obj *resultPtr;
static CONST char *optionStrings[] = {
"convertfrom", "convertto", "names", "system",
@@ -532,8 +523,8 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
* it will truncate the string at the first null byte.
*/
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
} else {
/*
@@ -542,10 +533,9 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
string = Tcl_GetStringFromObj(data, &length);
Tcl_UtfToExternalDString(encoding, string, length, &ds);
- resultPtr = Tcl_GetObjResult(interp);
- Tcl_SetByteArrayObj(resultPtr,
+ Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(
(unsigned char *) Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds));
+ Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
}
@@ -566,8 +556,8 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
if (objc == 2) {
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- Tcl_GetEncodingName(NULL), -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Tcl_GetEncodingName(NULL), -1));
} else {
return Tcl_SetSystemEncoding(interp,
Tcl_GetStringFromObj(objv[2], NULL));
@@ -875,7 +865,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
tval.actime = newTime;
tval.modtime = buf.st_mtime;
if (Tcl_FSUtime(objv[2], &tval) != 0) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ Tcl_AppendResult(interp,
"could not set access time for file \"",
Tcl_GetString(objv[2]), "\": ",
Tcl_PosixError(interp), (char *) NULL);
@@ -891,7 +881,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
}
- Tcl_SetLongObj(Tcl_GetObjResult(interp), (long) buf.st_atime);
+ Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_atime));
return TCL_OK;
}
case FCMD_ATTRIBUTES:
@@ -958,7 +948,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
if (GetStatBuf(NULL, objv[2], Tcl_FSStat, &buf) == TCL_OK) {
value = S_ISDIR(buf.st_mode);
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}
case FCMD_ISFILE: {
@@ -972,7 +962,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
if (GetStatBuf(NULL, objv[2], Tcl_FSStat, &buf) == TCL_OK) {
value = S_ISREG(buf.st_mode);
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}
case FCMD_JOIN: {
@@ -1135,7 +1125,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
tval.actime = buf.st_atime;
tval.modtime = newTime;
if (Tcl_FSUtime(objv[2], &tval) != 0) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ Tcl_AppendResult(interp,
"could not set modification time for file \"",
Tcl_GetString(objv[2]), "\": ",
Tcl_PosixError(interp), (char *) NULL);
@@ -1151,7 +1141,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
}
- Tcl_SetLongObj(Tcl_GetObjResult(interp), (long) buf.st_mtime);
+ Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_mtime));
return TCL_OK;
}
case FCMD_MKDIR:
@@ -1172,8 +1162,8 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
if (fileName == NULL) {
return TCL_ERROR;
}
- Tcl_SetStringObj(Tcl_GetObjResult(interp), fileName,
- Tcl_DStringLength(&ds));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(fileName,
+ Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
return TCL_OK;
}
@@ -1212,7 +1202,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
value = (geteuid() == buf.st_uid);
#endif
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}
case FCMD_PATHTYPE:
@@ -1221,14 +1211,14 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
}
switch (Tcl_FSGetPathType(objv[2])) {
case TCL_PATH_ABSOLUTE:
- Tcl_SetStringObj(Tcl_GetObjResult(interp), "absolute", -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("absolute", -1));
break;
case TCL_PATH_RELATIVE:
- Tcl_SetStringObj(Tcl_GetObjResult(interp), "relative", -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("relative", -1));
break;
case TCL_PATH_VOLUME_RELATIVE:
- Tcl_SetStringObj(Tcl_GetObjResult(interp), "volumerelative",
- -1);
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj("volumerelative", -1));
break;
}
return TCL_OK;
@@ -1313,8 +1303,8 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
if (GetStatBuf(interp, objv[2], Tcl_FSStat, &buf) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetWideIntObj(Tcl_GetObjResult(interp),
- (Tcl_WideInt) buf.st_size);
+ Tcl_SetObjResult(interp,
+ Tcl_NewWideIntObj((Tcl_WideInt) buf.st_size));
return TCL_OK;
}
case FCMD_SPLIT: {
@@ -1326,10 +1316,9 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
res = Tcl_FSSplitPath(objv[2], NULL);
if (res == NULL) {
if (interp != NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "could not read \"", Tcl_GetString(objv[2]),
- "\": no such file or directory",
- (char *) NULL);
+ Tcl_AppendResult(interp, "could not read \"",
+ Tcl_GetString(objv[2]),
+ "\": no such file or directory", (char *) NULL);
}
return TCL_ERROR;
} else {
@@ -1389,8 +1378,8 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
if (GetStatBuf(interp, objv[2], Tcl_FSLstat, &buf) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetStringObj(Tcl_GetObjResult(interp),
- GetTypeFromMode((unsigned short) buf.st_mode), -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ GetTypeFromMode((unsigned short) buf.st_mode), -1));
return TCL_OK;
}
case FCMD_VOLUMES:
@@ -1445,7 +1434,7 @@ CheckAccess(interp, pathPtr, mode)
} else {
value = (Tcl_FSAccess(pathPtr, mode) == 0);
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}
@@ -1811,8 +1800,7 @@ Tcl_ForeachObjCmd(dummy, interp, objc, objv)
goto done;
}
if (varcList[i] < 1) {
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "foreach varlist is empty", -1);
+ Tcl_AppendResult(interp, "foreach varlist is empty", NULL);
result = TCL_ERROR;
goto done;
}
@@ -1878,8 +1866,7 @@ Tcl_ForeachObjCmd(dummy, interp, objc, objv)
Tcl_DecrRefCount(valuePtr);
}
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "couldn't set loop variable: \"",
+ Tcl_AppendResult(interp, "couldn't set loop variable: \"",
Tcl_GetString(varvList[i][v]), "\"", (char *) NULL);
result = TCL_ERROR;
goto done;