summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
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/tclBinary.c
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/tclBinary.c')
-rw-r--r--generic/tclBinary.c10
1 files changed, 5 insertions, 5 deletions
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;