summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-10-06 05:52:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-10-06 05:52:20 (GMT)
commit329125679e274130e2405579330bd37c327f39c8 (patch)
treed99cff9d30ee720bbfff62625aec4088cc2a16b7 /generic/tclCompExpr.c
parent8d980d5957f426b122d14c323065a4d58821ac92 (diff)
downloadtcl-329125679e274130e2405579330bd37c327f39c8.zip
tcl-329125679e274130e2405579330bd37c327f39c8.tar.gz
tcl-329125679e274130e2405579330bd37c327f39c8.tar.bz2
* generic/tclBasic.c:
* generic/tclBinary.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompExpr.c: * generic/tclDictObj.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/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 33e4c09..64d28aa 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.23 2004/09/26 16:36:04 msofer Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.24 2004/10/06 05:52:21 dgp Exp $
*/
#include "tclInt.h"
@@ -838,8 +838,8 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
code = TCL_OK;
hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName);
if (hPtr == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "unknown math function \"", funcName, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "unknown math function \"", funcName,
+ "\"", (char *) NULL);
code = TCL_ERROR;
goto done;
}
@@ -862,9 +862,8 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
if (mathFuncPtr->numArgs > 0) {
for (i = 0; i < mathFuncPtr->numArgs; i++) {
if (tokenPtr == afterSubexprPtr) {
- Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "too few arguments for math function", -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "too few arguments for math function", -1));
code = TCL_ERROR;
goto done;
}
@@ -875,16 +874,14 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
tokenPtr += (tokenPtr->numComponents + 1);
}
if (tokenPtr != afterSubexprPtr) {
- Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "too many arguments for math function", -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "too many arguments for math function", -1));
code = TCL_ERROR;
goto done;
}
} else if (tokenPtr != afterSubexprPtr) {
- Tcl_ResetResult(interp);
- Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "too many arguments for math function", -1);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "too many arguments for math function", -1));
code = TCL_ERROR;
goto done;
}