summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-03-21 16:25:26 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-03-21 16:25:26 (GMT)
commit02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390 (patch)
tree949e678a48439df209cef1c01cd090f1b36c3ee6 /generic/tclExecute.c
parentb818f6e73d89388ec6500af4cbec3bebf532e939 (diff)
downloadtcl-02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390.zip
tcl-02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390.tar.gz
tcl-02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390.tar.bz2
* generic/tclExecute.c: More ckalloc -> ckrealloc conversions.
* generic/tclLiteral.c:
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index e15053b..2833ee8 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,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.262 2007/03/20 15:23:51 dkf Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.263 2007/03/21 16:25:27 dgp Exp $
*/
#include "tclInt.h"
@@ -564,8 +564,7 @@ GrowEvaluationStack(
int newElems = 2*currElems;
int currBytes = currElems * sizeof(Tcl_Obj *);
int newBytes = 2*currBytes;
- Tcl_Obj **newStackPtr = (Tcl_Obj **) ckalloc((unsigned) newBytes);
- Tcl_Obj **oldStackPtr = eePtr->stackPtr;
+ Tcl_Obj **newStackPtr, **oldStackPtr = eePtr->stackPtr;
/*
* We keep the stack reference count as a (char *), as that works nicely
@@ -574,30 +573,22 @@ GrowEvaluationStack(
char *refCount = (char *) oldStackPtr[-1];
- /*
- * Copy the existing stack items to the new stack space, free the old
- * storage if appropriate, and record the refCount of the new stack held
- * by the environment.
- */
-
- newStackPtr++;
- memcpy((VOID *) newStackPtr, (VOID *) oldStackPtr,
- (size_t) currBytes);
-
if (refCount == (char *) 1) {
- ckfree((VOID *) (oldStackPtr-1));
+ newStackPtr = (Tcl_Obj **) ckrealloc(
+ (char *) (oldStackPtr - 1), newBytes);
+ newStackPtr++;
} else {
- /*
- * Remove the reference corresponding to the environment pointer.
- */
-
+ /* Can't free oldStackPtr, so can't use ckrealloc */
+ newStackPtr = (Tcl_Obj **) ckalloc(newBytes);
+ newStackPtr++;
+ memcpy(newStackPtr, oldStackPtr, currBytes);
oldStackPtr[-1] = (Tcl_Obj *) (refCount-1);
+ newStackPtr[-1] = (Tcl_Obj *) ((char *) 1);
}
eePtr->stackPtr = newStackPtr;
eePtr->endPtr = newStackPtr + (newElems - 2); /* index of last usable item */
- eePtr->tosPtr += (newStackPtr - oldStackPtr);
- newStackPtr[-1] = (Tcl_Obj *) ((char *) 1);
+ eePtr->tosPtr = newStackPtr + (eePtr->tosPtr - oldStackPtr);
}
/*