summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-10-23 21:36:54 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-10-23 21:36:54 (GMT)
commit00a65742087d6d3b1aca1c8153ba4d16b169ee27 (patch)
tree3333dae28c1795f39b85a6647ffc38ca89c7e9b1 /generic/tclProc.c
parenta45dac076ba36370d50f550d483af81d54f88513 (diff)
downloadtcl-00a65742087d6d3b1aca1c8153ba4d16b169ee27.zip
tcl-00a65742087d6d3b1aca1c8153ba4d16b169ee27.tar.gz
tcl-00a65742087d6d3b1aca1c8153ba4d16b169ee27.tar.bz2
* generic/tcl.h: Modified the Tcl call stack so
* generic/tclBasic.c: there is always a valid CallFrame, even * generic/tclCmdIL.c: at level 0 [Patch 1577278]. Most of the * generic/tclInt.h: changes involve removing tests for * generic/tclNamesp.c: iPtr->(var)framePtr==NULL. There is now a * generic/tclObj.c: CallFrame pushed at interp creation * generic/tclProc.c: with a pointer to it stored in * generic/tclTrace.c: iPtr->rootFramePtr. A second unused * generic/tclVar.c: field in Interp is hijacked to enable further functionality, currently unused (but with several FRQs depending on it).
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 6429488..e6a70ab 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.95 2006/10/20 15:16:47 dkf Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.96 2006/10/23 21:36:55 msofer Exp $
*/
#include "tclInt.h"
@@ -604,7 +604,7 @@ TclGetFrame(
*/
result = 1;
- curLevel = (iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level;
+ curLevel = iPtr->varFramePtr->level;
if (*name== '#') {
if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
goto levelError;
@@ -623,19 +623,16 @@ TclGetFrame(
* Figure out which frame to use, and return it to the caller.
*/
- if (level == 0) {
- framePtr = NULL;
- } else {
- for (framePtr = iPtr->varFramePtr; framePtr != NULL;
- framePtr = framePtr->callerVarPtr) {
- if (framePtr->level == level) {
- break;
- }
- }
- if (framePtr == NULL) {
- goto levelError;
+ for (framePtr = iPtr->varFramePtr; framePtr != NULL;
+ framePtr = framePtr->callerVarPtr) {
+ if (framePtr->level == level) {
+ break;
}
}
+ if (framePtr == NULL) {
+ goto levelError;
+ }
+
*framePtrPtr = framePtr;
return result;
@@ -687,7 +684,7 @@ TclObjGetFrame(
*/
result = 1;
- curLevel = (iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level;
+ curLevel = iPtr->varFramePtr->level;
if (objPtr->typePtr == &levelReferenceType) {
if ((int) objPtr->internalRep.twoPtrValue.ptr1) {
level = curLevel - (int) objPtr->internalRep.twoPtrValue.ptr2;
@@ -753,19 +750,15 @@ TclObjGetFrame(
* Figure out which frame to use, and return it to the caller.
*/
- if (level == 0) {
- framePtr = NULL;
- } else {
- for (framePtr = iPtr->varFramePtr; framePtr != NULL;
- framePtr = framePtr->callerVarPtr) {
- if (framePtr->level == level) {
- break;
- }
- }
- if (framePtr == NULL) {
- goto levelError;
+ for (framePtr = iPtr->varFramePtr; framePtr != NULL;
+ framePtr = framePtr->callerVarPtr) {
+ if (framePtr->level == level) {
+ break;
}
}
+ if (framePtr == NULL) {
+ goto levelError;
+ }
*framePtrPtr = framePtr;
return result;