summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-07-06 16:47:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-07-06 16:47:37 (GMT)
commit5afe70d02240e1acbe825478808f3ef27847c025 (patch)
tree910ee54327dd35984c3df8f989dc7ea4a550662a /generic/tclBasic.c
parent3b1d8286ed07d9ddcea89d5e11497062a77dc85e (diff)
downloadtcl-5afe70d02240e1acbe825478808f3ef27847c025.zip
tcl-5afe70d02240e1acbe825478808f3ef27847c025.tar.gz
tcl-5afe70d02240e1acbe825478808f3ef27847c025.tar.bz2
Create and use a utility Tcl_NRPostProc when decr ref count of values is
all that is needed.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 7235be1..d6a460d 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -146,7 +146,6 @@ static int TEOV_RunEnterTraces(Tcl_Interp *interp,
Command **cmdPtrPtr, Tcl_Obj *commandPtr, int objc,
Tcl_Obj *const objv[]);
static Tcl_NRPostProc RewindCoroutineCallback;
-static Tcl_NRPostProc TailcallCleanup;
static Tcl_NRPostProc TEOEx_ByteCodeCallback;
static Tcl_NRPostProc TEOEx_ListCallback;
static Tcl_NRPostProc TEOV_Error;
@@ -8371,7 +8370,7 @@ TclNRTailcallEval(
* a now-gone namespace: cleanup and return.
*/
- TailcallCleanup(data, interp, result);
+ Tcl_DecrRefCount(listPtr);
return result;
}
@@ -8380,18 +8379,26 @@ TclNRTailcallEval(
*/
TclMarkTailcall(interp);
- TclNRAddCallback(interp, TailcallCleanup, listPtr, NULL, NULL,NULL);
+ TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL);
iPtr->lookupNsPtr = (Namespace *) nsPtr;
return TclNREvalObjv(interp, objc-1, objv+1, 0, NULL);
}
-static int
-TailcallCleanup(
+int
+TclNRReleaseValues(
ClientData data[],
Tcl_Interp *interp,
int result)
{
- Tcl_DecrRefCount((Tcl_Obj *) data[0]);
+ int i = 0;
+ while (i < 4) {
+ if (data[i]) {
+ Tcl_DecrRefCount((Tcl_Obj *) data[i]);
+ } else {
+ break;
+ }
+ i++;
+ }
return result;
}