diff options
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 29 |
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); } /* |