From 3b911b1e99e8f3e7b310b2c3c2453d66ee1d2885 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Thu, 28 Feb 2002 13:03:53 +0000 Subject: Replaced a few direct stack accesses with the POP_OBJECT() macro [Bug 507181] --- ChangeLog | 5 +++++ generic/tclExecute.c | 28 +++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index c379368..7505cd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-02-28 Miguel Sofer + + * generic/tclExecute.c: Replaced a few direct stack accesses + with the POP_OBJECT() macro [Bug 507181] (Don Porter). + 2002-02-27 Don Porter * doc/GetIndex.3: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 21eb610..1745650 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.48 2002/02/15 19:58:28 andreas_kupries Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.49 2002/02/28 13:03:53 msofer Exp $ */ #include "tclInt.h" @@ -1371,9 +1371,8 @@ TclExecuteByteCode(interp, codePtr) */ for (i = 0; i < objc; i++) { - valuePtr = stackPtr[stackTop]; + valuePtr = POP_OBJECT(); TclDecrRefCount(valuePtr); - stackTop--; } /* @@ -1886,11 +1885,10 @@ TclExecuteByteCode(interp, codePtr) opnd = TclGetUInt4AtPtr(pc+1); valuePtr = Tcl_NewListObj(opnd, &(stackPtr[stackTop - (opnd-1)])); - - for (i = 0; i < opnd; stackTop--, i++) { - TclDecrRefCount(stackPtr[stackTop]); + for (i = 0; i < opnd; i++) { + objPtr = POP_OBJECT(); + TclDecrRefCount(objPtr); } - PUSH_OBJECT(valuePtr); TRACE_WITH_OBJ(("%u => ", opnd), valuePtr); ADJUST_PC(5); @@ -2609,7 +2607,8 @@ TclExecuteByteCode(interp, codePtr) /* * Watch out for multiple references in macros! */ - valuePtr = stackPtr[stackTop--]; + + valuePtr = POP_OBJECT(); TclDecrRefCount(valuePtr); } @@ -2670,7 +2669,8 @@ TclExecuteByteCode(interp, codePtr) /* * Watch out for multiple references in macros! */ - valuePtr = stackPtr[stackTop--]; + + valuePtr = POP_OBJECT(); TclDecrRefCount(valuePtr); } @@ -5822,14 +5822,12 @@ ExprCallMathFunc(interp, eePtr, objc, objv) /* * Pop the objc top stack elements and decrement their ref counts. */ - - i = (stackTop - (objc-1)); - while (i <= stackTop) { - valuePtr = stackPtr[i]; + + k = (stackTop - (objc-1)); + while (stackTop >= k) { + valuePtr = POP_OBJECT(); TclDecrRefCount(valuePtr); - i++; } - stackTop -= objc; /* * Push the call's object result. -- cgit v0.12