summaryrefslogtreecommitdiffstats
path: root/generic/tclScan.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/tclScan.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/tclScan.c')
-rw-r--r--generic/tclScan.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 69e4170..624910c 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclScan.c,v 1.15 2004/08/19 20:59:00 dkf Exp $
+ * RCS: @(#) $Id: tclScan.c,v 1.16 2004/10/06 15:59:25 dgp Exp $
*/
#include "tclInt.h"
@@ -396,7 +396,7 @@ ValidateFormat(interp, format, numVars, totalSubs)
if (flags & SCAN_LONGER) {
invalidLonger:
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ Tcl_AppendResult(interp,
"'l' modifier may not be specified in %", buf,
" conversion", NULL);
goto error;
@@ -452,8 +452,8 @@ ValidateFormat(interp, format, numVars, totalSubs)
char buf[TCL_UTF_MAX+1];
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "bad scan conversion character \"", buf, "\"", NULL);
+ Tcl_AppendResult(interp, "bad scan conversion character \"",
+ buf, "\"", NULL);
goto error;
}
}
@@ -1167,8 +1167,7 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv)
result++;
if (Tcl_ObjSetVar2(interp, objv[i+3], NULL,
objs[i], 0) == NULL) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "couldn't set variable \"",
+ Tcl_AppendResult(interp, "couldn't set variable \"",
Tcl_GetString(objv[i+3]), "\"", (char *) NULL);
code = TCL_ERROR;
}