summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-12-13 18:39:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-12-13 18:39:12 (GMT)
commit9c336539e4efc2577c7977a99679a133bf4569c5 (patch)
tree6a2d88bcb1d5a953893de2974417038795c1b698
parent6c9f0c69b67589dd2c52c36bdd3fd3a7fb8e6f60 (diff)
downloadtcl-9c336539e4efc2577c7977a99679a133bf4569c5.zip
tcl-9c336539e4efc2577c7977a99679a133bf4569c5.tar.gz
tcl-9c336539e4efc2577c7977a99679a133bf4569c5.tar.bz2
Simplify the coding of the unchain operation.
-rw-r--r--generic/tclCmdIL.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 57434c1..fc2c367 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -105,7 +105,6 @@ typedef struct SortInfo {
*/
static CmdFrame * CmdFrameChain(CoroutineData *corPtr);
-static void CmdFrameUnchain(CoroutineData *corPtr);
static int DictionaryCompare(const char *left, const char *right);
static int IfConditionCallback(ClientData data[],
Tcl_Interp *interp, int result);
@@ -1150,7 +1149,7 @@ InfoFrameCmd(
{
Interp *iPtr = (Interp *) interp;
int level, topLevel, code = TCL_OK;
- CmdFrame *runPtr, *framePtr;
+ CmdFrame *runPtr, *framePtr, **cmdFramePtrPtr = &iPtr->cmdFramePtr;
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
if (objc > 2) {
@@ -1235,36 +1234,13 @@ InfoFrameCmd(
Tcl_SetObjResult(interp, TclInfoFrame(interp, framePtr));
done:
- if (corPtr) {
+ while (corPtr) {
+ CmdFrame *endPtr = corPtr->caller.cmdFramePtr;
- if (iPtr->cmdFramePtr == corPtr->caller.cmdFramePtr) {
- iPtr->cmdFramePtr = NULL;
+ if (*cmdFramePtrPtr == endPtr) {
+ *cmdFramePtrPtr = NULL;
} else {
- runPtr = iPtr->cmdFramePtr;
- while (runPtr->nextPtr != corPtr->caller.cmdFramePtr) {
- runPtr->level -= corPtr->caller.cmdFramePtr->level;
- runPtr = runPtr->nextPtr;
- }
- runPtr->level = 1;
- runPtr->nextPtr = NULL;
- }
- CmdFrameUnchain(corPtr);
-
- }
- return code;
-}
-
-static void
-CmdFrameUnchain(
- CoroutineData *corPtr)
-{
- if (corPtr->callerEEPtr->corPtr) {
- CmdFrame *endPtr = corPtr->callerEEPtr->corPtr->caller.cmdFramePtr;
-
- if (corPtr->caller.cmdFramePtr == endPtr) {
- corPtr->caller.cmdFramePtr = NULL;
- } else {
- CmdFrame *runPtr = corPtr->caller.cmdFramePtr;
+ CmdFrame *runPtr = *cmdFramePtrPtr;
while (runPtr->nextPtr != endPtr) {
runPtr->level -= endPtr->level;
@@ -1273,8 +1249,10 @@ CmdFrameUnchain(
runPtr->level = 1;
runPtr->nextPtr = NULL;
}
- CmdFrameUnchain(corPtr->callerEEPtr->corPtr);
+ cmdFramePtrPtr = &corPtr->caller.cmdFramePtr;
+ corPtr = corPtr->callerEEPtr->corPtr;
}
+ return code;
}
static CmdFrame *