summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-06-22 17:09:15 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-06-22 17:09:15 (GMT)
commit6d2ef9cec6186ac320b6baea1c8c35d20b953061 (patch)
tree9c19ed0c63b59641ab72595ab8bc69512cc25b1c /generic/tclExecute.c
parentabe71b0d5a315b3f7fa348e2318547e5180ef089 (diff)
downloadtcl-6d2ef9cec6186ac320b6baea1c8c35d20b953061.zip
tcl-6d2ef9cec6186ac320b6baea1c8c35d20b953061.tar.gz
tcl-6d2ef9cec6186ac320b6baea1c8c35d20b953061.tar.bz2
* generic/tclExecute.c: Revised TclStackRealloc() signature to better
* generic/tclInt.h: parallel (and fall back on) Tcl_Realloc. * generic/tclNamesp.c (TclResetShadowesCmdRefs): Replaced ckrealloc based allocations with TclStackRealloc allocations.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 21109cb..d51c8fd 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.302 2007/06/21 17:45:40 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.303 2007/06/22 17:09:17 dgp Exp $
*/
#include "tclInt.h"
@@ -444,8 +444,6 @@ static void DeleteExecStack(ExecStack *esPtr);
static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, int numWords);
static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, int numWords);
-/* Move to internal stubs? For now, unused */
-extern char * TclStackRealloc(Tcl_Interp *interp, int numBytes);
/*
*----------------------------------------------------------------------
@@ -878,14 +876,33 @@ TclStackAlloc(
return (void *) StackAllocWords(interp, numWords);
}
-char *
+void *
TclStackRealloc(
Tcl_Interp *interp,
+ void *ptr,
int numBytes)
{
- int numWords = (numBytes + sizeof(void *) - 1)/sizeof(void *);
+ Interp *iPtr;
+ ExecEnv *eePtr;
+ ExecStack *esPtr;
+ Tcl_Obj **markerPtr;
+ int numWords;
+
+ if (interp == NULL) {
+ return (void *) Tcl_Realloc((char *) ptr, numBytes);
+ }
+
+ iPtr = (Interp *) interp;
+ eePtr = iPtr->execEnvPtr;
+ esPtr = eePtr->execStackPtr;
+ markerPtr = esPtr->markerPtr;
+
+ if ((markerPtr+1) != (Tcl_Obj **)ptr) {
+ Tcl_Panic("TclStackRealloc: incorrect ptr. Call out of sequence?");
+ }
- return (char *) StackReallocWords(interp, numWords);
+ numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *);
+ return (void *) StackReallocWords(interp, numWords);
}
/*