diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2001-11-20 19:45:19 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2001-11-20 19:45:19 (GMT) |
commit | 6a486a8037e4f19601182dd4ff17bf7ba9d7ce38 (patch) | |
tree | e0a52e0971a8aa816d4be0d839763b106111c61a /generic/tclBasic.c | |
parent | f65f73ec08266d7dd392834136232173690604a8 (diff) | |
download | tcl-6a486a8037e4f19601182dd4ff17bf7ba9d7ce38.zip tcl-6a486a8037e4f19601182dd4ff17bf7ba9d7ce38.tar.gz tcl-6a486a8037e4f19601182dd4ff17bf7ba9d7ce38.tar.bz2 |
a better variant of the previous-to-last commit (restoring numLevels computations)
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fc5e49e..18acb81 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.38 2001/11/19 17:30:27 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.39 2001/11/20 19:45:19 msofer Exp $ */ #include "tclInt.h" @@ -2796,11 +2796,10 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) * it's probably because of an infinite loop somewhere. */ - if (iPtr->numLevels >= iPtr->maxNestingDepth) { + if (iPtr->numLevels > iPtr->maxNestingDepth) { iPtr->result = "too many nested calls to Tcl_Eval (infinite loop?)"; return TCL_ERROR; } - iPtr->numLevels++; /* * On the Mac, we will never reach the default recursion limit before @@ -2809,7 +2808,6 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) if (TclpCheckStackSpace() == 0) { /*NOTREACHED*/ - iPtr->numLevels--; iPtr->result = "too many nested calls to Tcl_Eval (infinite loop?)"; return TCL_ERROR; } @@ -2838,7 +2836,9 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) (char *) NULL); code = TCL_ERROR; } else { + iPtr->numLevels++; code = TclEvalObjvInternal(interp, objc+1, newObjv, command, length, 0); + iPtr->numLevels--; } Tcl_DecrRefCount(newObjv[0]); ckfree((char *) newObjv); @@ -2918,7 +2918,6 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) } done: - iPtr->numLevels--; return code; } @@ -2962,10 +2961,7 @@ Tcl_EvalObjv(interp, objc, objv, flags) int code = TCL_OK; for (tracePtr = iPtr->tracePtr; tracePtr; tracePtr = tracePtr->nextPtr) { - /* - * EvalObjv will increment numLevels so use "<" rather than "<=" - */ - if (iPtr->numLevels < tracePtr->level) { + if (iPtr->numLevels <= tracePtr->level) { int i; /* * The command will be needed for an execution trace or stack trace @@ -2987,7 +2983,9 @@ Tcl_EvalObjv(interp, objc, objv, flags) */ switch (code) { case TCL_OK: + iPtr->numLevels++; code = TclEvalObjvInternal(interp, objc, objv, cmdString, cmdLen, flags); + iPtr->numLevels--; if (code == TCL_ERROR && cmdLen == 0) goto cmdtraced; break; @@ -3417,8 +3415,10 @@ Tcl_EvalEx(interp, script, numBytes, flags) /* * Execute the command and free the objects for its words. */ - + + iPtr->numLevels++; code = TclEvalObjvInternal(interp, objectsUsed, objv, p, bytesLeft, 0); + iPtr->numLevels--; if (code != TCL_OK) { goto error; } |