From 7f87f0f8ea86cf01682eb02e4fa8c313dc6ef4ef Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 27 Jan 2023 19:15:09 +0000 Subject: Add some comments and tidy code. --- generic/tclBasic.c | 3 ++- generic/tclExecute.c | 2 +- generic/tclNamesp.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index bea5996..cdaf6fe 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -9716,6 +9716,7 @@ TclNRYieldToObjCmd( */ iPtr->execEnvPtr = corPtr->callerEEPtr; + /* Not calling Tcl_IncrRefCount(listPtr) here because listPtr is private */ TclSetTailcall(interp, listPtr); corPtr->yieldPtr = listPtr; iPtr->execEnvPtr = corPtr->eePtr; @@ -9918,8 +9919,8 @@ TclNRCoroutineActivateCallback( if (corPtr->yieldPtr) { for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) { if (runPtr->data[1] == corPtr->yieldPtr) { + Tcl_DecrRefCount(runPtr->data[1]); runPtr->data[1] = NULL; - Tcl_DecrRefCount(corPtr->yieldPtr); corPtr->yieldPtr = NULL; break; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ec144a2..7ee5471 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2503,8 +2503,8 @@ TEBCresume( * 'yieldParameter'). */ - Tcl_IncrRefCount(valuePtr); iPtr->execEnvPtr = corPtr->callerEEPtr; + Tcl_IncrRefCount(valuePtr); TclSetTailcall(interp, valuePtr); corPtr->yieldPtr = valuePtr; iPtr->execEnvPtr = corPtr->eePtr; diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 6269bbe..5a2979e 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -417,6 +417,8 @@ Tcl_PopCallFrame( framePtr->nsPtr = NULL; if (framePtr->tailcallPtr) { + /* Reusing the existing reference count from framePtr->tailcallPtr, so + * no need to Tcl_IncrRefCount(framePtr->tailcallPtr)*/ TclSetTailcall(interp, framePtr->tailcallPtr); } } -- cgit v0.12 From d3dae9eba4c8d979d72feddfded60eb08835543d Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Jan 2023 15:37:41 +0000 Subject: silence compiler warning --- generic/tclBasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index cdaf6fe..a31bfb6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -9919,7 +9919,7 @@ TclNRCoroutineActivateCallback( if (corPtr->yieldPtr) { for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) { if (runPtr->data[1] == corPtr->yieldPtr) { - Tcl_DecrRefCount(runPtr->data[1]); + Tcl_DecrRefCount((Tcl_Obj *)runPtr->data[1]); runPtr->data[1] = NULL; corPtr->yieldPtr = NULL; break; -- cgit v0.12