summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-10-05 18:14:24 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-10-05 18:14:24 (GMT)
commiteab3283014b276dd97ea9817fb75bf47c6181959 (patch)
tree88717c7d63e6416c4f15a3f6e1c96edd873699dc /generic/tclResult.c
parentafd7b17255862ddee543ced29fb8e728965cf992 (diff)
downloadtcl-eab3283014b276dd97ea9817fb75bf47c6181959.zip
tcl-eab3283014b276dd97ea9817fb75bf47c6181959.tar.gz
tcl-eab3283014b276dd97ea9817fb75bf47c6181959.tar.bz2
* generic/tclBasic.c (Tcl_CreateInterp,Tcl_DeleteInterp,
TclEvalObjvInternal,Tcl_LogCommandInfo): * generic/tclCmdAH.c (Tcl_CatchObjCmd): * generic/tclEvent.c (BgError,Tcl_BackgroundError,HandleBgErrors): * generic/tclInt.h (Interp, ERROR_CODE_SET): * generic/tclNamesp.c (Tcl_CreateNamespace,Tcl_DeleteNamespace,TclTeardownNamespace): * generic/tclResult.c (Tcl_ResetResult,Tcl_SetObjErrorCode,TclTransferResult): * generic/tclTrace.c (CallVarTraces): Reworked management of the "errorCode" data of an interp. That information is now primarily stored in a new private (Tcl_Obj *) field of the Interp struct, rather than using a global variable ::errorCode as the primary storage. The ERROR_CODE_SET flag bit value is no longer required to manage the value in its new location, and is removed. Variable traces are established to support compatibility for any code expecting the ::errorCode variable to hold the information.
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r--generic/tclResult.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 9e83796..2bd52dd 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.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: tclResult.c,v 1.11 2004/09/30 23:06:48 dgp Exp $
+ * RCS: @(#) $Id: tclResult.c,v 1.12 2004/10/05 18:14:28 dgp Exp $
*/
#include "tclInt.h"
@@ -801,7 +801,13 @@ Tcl_ResetResult(interp)
}
iPtr->result = iPtr->resultSpace;
iPtr->resultSpace[0] = 0;
- iPtr->flags &= ~(ERR_ALREADY_LOGGED | ERR_IN_PROGRESS | ERROR_CODE_SET);
+ if (iPtr->errorCode) {
+ Tcl_ObjSetVar2(interp, iPtr->execEnvPtr->errorCode, NULL,
+ iPtr->errorCode, TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(iPtr->errorCode);
+ iPtr->errorCode = NULL;
+ }
+ iPtr->flags &= ~(ERR_ALREADY_LOGGED | ERR_IN_PROGRESS);
}
/*
@@ -955,9 +961,11 @@ Tcl_SetObjErrorCode(interp, errorObjPtr)
{
Interp *iPtr = (Interp *) interp;
- Tcl_ObjSetVar2(interp, iPtr->execEnvPtr->errorCode, NULL,
- errorObjPtr, TCL_GLOBAL_ONLY);
- iPtr->flags |= ERROR_CODE_SET;
+ if (iPtr->errorCode) {
+ Tcl_DecrRefCount(iPtr->errorCode);
+ }
+ iPtr->errorCode = errorObjPtr;
+ Tcl_IncrRefCount(iPtr->errorCode);
}
/*
@@ -1033,8 +1041,7 @@ TclTransferResult(sourceInterp, result, targetInterp)
((Interp *) targetInterp)->flags |= ERR_IN_PROGRESS;
}
- objPtr = Tcl_GetVar2Ex(sourceInterp, "errorCode", NULL,
- TCL_GLOBAL_ONLY);
+ objPtr = ((Interp *) sourceInterp)->errorCode;
if (objPtr) {
Tcl_SetObjErrorCode(targetInterp, objPtr);
}