summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-10-06 15:59:22 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-10-06 15:59:22 (GMT)
commitb0e29724338467351f10a4b11e317a5866ac658f (patch)
treed861bb4c44fd414c034f6faa23c736648d498e29 /generic/tclUtil.c
parenta57d7ac68eaafc7de2e3f9d05a148384f3716f52 (diff)
downloadtcl-b0e29724338467351f10a4b11e317a5866ac658f.zip
tcl-b0e29724338467351f10a4b11e317a5866ac658f.tar.gz
tcl-b0e29724338467351f10a4b11e317a5866ac658f.tar.bz2
* generic/tclBasic.c:
* generic/tclBinary.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompExpr.c: * generic/tclDictObj.c: * generic/tclEncoding.c: * generic/tclExecute.c: * generic/tclFCmd.c: * generic/tclHistory.c: * generic/tclIndexObj.c: * generic/tclInterp.c: * generic/tclIO.c: * generic/tclIOCmd.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclPkg.c: * generic/tclResult.c: * generic/tclScan.c: * generic/tclTimer.c: * generic/tclTrace.c: * generic/tclUtil.c: * generic/tclVar.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/tclUtil.c')
-rw-r--r--generic/tclUtil.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 819f3b5..1a4b841 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.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: tclUtil.c,v 1.46 2004/09/29 22:17:29 dkf Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.47 2004/10/06 15:59:25 dgp Exp $
*/
#include "tclInt.h"
@@ -1764,10 +1764,7 @@ Tcl_DStringGetResult(interp, dsPtr)
* string result, then reset the object result.
*/
- if (*(iPtr->result) == 0) {
- Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)),
- TCL_VOLATILE);
- }
+ (void) Tcl_GetStringResult(interp);
dsPtr->length = strlen(iPtr->result);
if (iPtr->freeProc != NULL) {
@@ -2331,10 +2328,8 @@ TclGetIntForIndex(interp, objPtr, endValue, indexPtr)
* because this is an error-generation path anyway.
*/
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "bad index \"", bytes,
- "\": must be integer or end?-integer?",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad index \"", bytes,
+ "\": must be integer or end?-integer?", (char *) NULL);
if (!strncmp(bytes, "end-", 3)) {
bytes += 3;
}
@@ -2426,10 +2421,8 @@ SetEndOffsetFromAny(interp, objPtr)
(size_t)((length > 3) ? 3 : length)) != 0)) {
if (interp != NULL) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "bad index \"", bytes,
- "\": must be end?-integer?",
- (char*) NULL);
+ Tcl_AppendResult(interp, "bad index \"", bytes,
+ "\": must be end?-integer?", (char*) NULL);
}
return TCL_ERROR;
}
@@ -2453,10 +2446,8 @@ SetEndOffsetFromAny(interp, objPtr)
*/
if (interp != NULL) {
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "bad index \"", bytes,
- "\": must be integer or end?-integer?",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad index \"", bytes,
+ "\": must be integer or end?-integer?", (char *) NULL);
}
return TCL_ERROR;
}