summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c27
-rw-r--r--generic/tclInt.h6
2 files changed, 12 insertions, 21 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 2684986..53cd4fd 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -14,7 +14,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.273 2007/11/10 16:08:09 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.274 2007/11/10 19:01:34 msofer Exp $
*/
#include "tclInt.h"
@@ -338,15 +338,15 @@ static const OpCmdInfo mathOpCmds[] = {
static int stackGrowsDown = 1;
#define GetCStackParams(iPtr) \
- stackGrowsDown = TclpGetCStackParams(&((iPtr)->stackBoundPtr))
+ stackGrowsDown = TclpGetCStackParams(&((iPtr)->stackBound))
-#define CheckStackSpace(iPtr, localIntPtr) \
+#define StackOverflow(iPtr, localIntPtr) \
(stackGrowsDown \
- ? ((localIntPtr) > *((iPtr)->stackBoundPtr)) \
- : ((localIntPtr) < *((iPtr)->stackBoundPtr)) \
+ ? ((localIntPtr) < (iPtr)->stackBound) \
+ : ((localIntPtr) > (iPtr)->stackBound) \
)
#else /* stack check disabled: make them noops */
-#define CheckStackSpace(interp, localIntPtr) 1
+#define StackOverflow(interp, localIntPtr) 0
#define GetCStackParams(iPtr)
#endif
@@ -3407,7 +3407,7 @@ int
TclInterpReady(
Tcl_Interp *interp)
{
- int localInt, stackOverflow; /* used for checking the stack */
+ int localInt; /* used for checking the stack */
register Interp *iPtr = (Interp *) interp;
/*
@@ -3435,17 +3435,8 @@ TclInterpReady(
* probably because of an infinite loop somewhere.
*/
- stackOverflow = !CheckStackSpace(iPtr, &localInt);
- if (stackOverflow) {
- /*
- * Update the stack params in case the thread's stack was grown.
- */
-
- GetCStackParams(iPtr);
- stackOverflow = !CheckStackSpace(iPtr, &localInt);
- }
-
- if (stackOverflow || ((iPtr->numLevels) > iPtr->maxNestingDepth)) {
+ if (((iPtr->numLevels) > iPtr->maxNestingDepth)
+ || StackOverflow(iPtr, &localInt)) {
Tcl_AppendResult(interp,
"too many nested evaluations (infinite loop?)", NULL);
return TCL_ERROR;
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 1dc744c..6a72767 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -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: tclInt.h,v 1.339 2007/11/10 16:08:10 msofer Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.340 2007/11/10 19:01:35 msofer Exp $
*/
#ifndef _TCLINT
@@ -1855,7 +1855,7 @@ typedef struct Interp {
* tclObj.c and tclThreadAlloc.c */
int *asyncReadyPtr; /* Pointer to the asyncReady indicator for
* this interp's thread; see tclAsync.c */
- int **stackBoundPtr; /* Pointer to the limit stack address
+ int *stackBound; /* Pointer to the limit stack address
* allowable for invoking a new command
* without "risking" a C-stack overflow;
* see TclpCheckStackSpace in the
@@ -2502,7 +2502,7 @@ MODULE_SCOPE int TclParseAllWhiteSpace(CONST char *src, int numBytes);
MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp,
int code, int level, Tcl_Obj *returnOpts);
#ifndef TCL_NO_STACK_CHECK
-MODULE_SCOPE int TclpGetCStackParams(int ***stackBound);
+MODULE_SCOPE int TclpGetCStackParams(int **stackBoundPtr);
#endif
MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);