diff options
author | dgp <dgp@users.sourceforge.net> | 2004-10-06 16:37:17 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-10-06 16:37:17 (GMT) |
commit | 757296c3e92ae4145012c8081d89063fd84fac6d (patch) | |
tree | 9f4375cdd57e3a0d6be40c390fc31ca0d3834d4b /win/tclWinPipe.c | |
parent | c9460f40ff148c46d7f52e7b5d7d7d16f32d64e1 (diff) | |
download | tcl-757296c3e92ae4145012c8081d89063fd84fac6d.zip tcl-757296c3e92ae4145012c8081d89063fd84fac6d.tar.gz tcl-757296c3e92ae4145012c8081d89063fd84fac6d.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:
* unix/tclUnixFCmd.c:
* unix/tclUnixPipe.c:
* win/tclWinDde.c:
* win/tclWinFCmd.c:
* win/tclWinPipe.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.
* library/dde/pkgIndex.tcl: Bump to dde 1.3.1
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r-- | win/tclWinPipe.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 13e26cd..b055afc 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.49 2004/10/06 14:35:20 dkf Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.50 2004/10/06 16:37:18 dgp Exp $ */ #include "tclWinInt.h" @@ -2699,9 +2699,8 @@ Tcl_PidObjCmd( return TCL_ERROR; } if (objc == 1) { - resultPtr = Tcl_GetObjResult(interp); wsprintfA(buf, "%lu", (unsigned long) getpid()); - Tcl_SetStringObj(resultPtr, buf, -1); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); } else { chan = Tcl_GetChannel(interp, Tcl_GetStringFromObj(objv[1], NULL), NULL); @@ -2714,12 +2713,13 @@ Tcl_PidObjCmd( } pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan); - resultPtr = Tcl_GetObjResult(interp); + resultPtr = Tcl_NewObj(); for (i = 0; i < pipePtr->numPids; i++) { wsprintfA(buf, "%lu", TclpGetPid(pipePtr->pidPtr[i])); Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr, Tcl_NewStringObj(buf, -1)); } + Tcl_SetObjResult(interp, resultPtr); } return TCL_OK; } |