summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-06-20 18:46:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-06-20 18:46:05 (GMT)
commit990150fd25c8206ca25d424fafbdfd2b81199d1f (patch)
tree3d231361d50bc42a020d3f65eefb68a5951da2ae /generic/tclCompExpr.c
parent03e71e94a6bfa74deaf5a629ba1b72353f17bfc7 (diff)
downloadtcl-990150fd25c8206ca25d424fafbdfd2b81199d1f.zip
tcl-990150fd25c8206ca25d424fafbdfd2b81199d1f.tar.gz
tcl-990150fd25c8206ca25d424fafbdfd2b81199d1f.tar.bz2
* generic/tclInt.decls: Revised the interfaces of the routines
* generic/tclExecute.c: TclStackAlloc and TclStackFree to make them easier for callers to use (or more precisely, harder to misuse). TclStackFree now takes a (void *) argument which is the pointer intended to be freed. TclStackFree will panic if that's not actually the memory the call will free. TSA/TSF also now tolerate receiving (interp == NULL), in which case they simply fall back to be calls to Tcl_Alloc/Tcl_Free. * generic/tclIntDecls.h: make genstubs * generic/tclBasic.c: Updated callers * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCompCmds.c: * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclFCmd.c: * generic/tclFileName.c: * generic/tclIOCmd.c: * generic/tclIndexObj.c: * generic/tclInterp.c: * generic/tclNamesp.c: * generic/tclProc.c: * generic/tclTrace.c: * unix/tclUnixPipe.c:
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index f24c505..7465135 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.53 2007/04/25 19:07:07 dgp Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.54 2007/06/20 18:46:11 dgp Exp $
*/
#include "tclInt.h"
@@ -2460,7 +2460,7 @@ CompileExprTree(
{
OpNode *nodePtr = nodes;
int nextFunc = 0;
- JumpList *jumpPtr = NULL;
+ JumpList *freePtr, *jumpPtr = NULL;
static const int instruction[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -2642,9 +2642,12 @@ CompileExprTree(
jumpPtr->offset - jumpPtr->jump.codeOffset, 127);
*convertPtr |= jumpPtr->convert;
envPtr->currStackDepth = jumpPtr->depth + 1;
- jumpPtr = jumpPtr->next->next;
- TclStackFree(interp);
- TclStackFree(interp);
+ freePtr = jumpPtr;
+ jumpPtr = jumpPtr->next;
+ TclStackFree(interp, freePtr);
+ freePtr = jumpPtr;
+ jumpPtr = jumpPtr->next;
+ TclStackFree(interp, freePtr);
} else if (nodePtr->lexeme == AND) {
TclEmitForwardJump(envPtr, TCL_FALSE_JUMP,
&(jumpPtr->next->jump));
@@ -2672,10 +2675,15 @@ CompileExprTree(
&(jumpPtr->next->next->jump), 127);
*convertPtr = 0;
envPtr->currStackDepth = jumpPtr->depth + 1;
- jumpPtr = jumpPtr->next->next->next;
- TclStackFree(interp);
- TclStackFree(interp);
- TclStackFree(interp);
+ freePtr = jumpPtr;
+ jumpPtr = jumpPtr->next;
+ TclStackFree(interp, freePtr);
+ freePtr = jumpPtr;
+ jumpPtr = jumpPtr->next;
+ TclStackFree(interp, freePtr);
+ freePtr = jumpPtr;
+ jumpPtr = jumpPtr->next;
+ TclStackFree(interp, freePtr);
}
nodePtr = nodes + nodePtr->parent;
}
@@ -2708,7 +2716,7 @@ OpCmd(
Tcl_IncrRefCount(byteCodeObj);
TclInitByteCodeObj(byteCodeObj, compEnvPtr);
TclFreeCompileEnv(compEnvPtr);
- TclStackFree(interp); /* compEnvPtr */
+ TclStackFree(interp, compEnvPtr);
byteCodePtr = (ByteCode *) byteCodeObj->internalRep.otherValuePtr;
code = TclExecuteByteCode(interp, byteCodePtr);
Tcl_DecrRefCount(byteCodeObj);
@@ -2794,8 +2802,8 @@ TclSortingOpCmd(
code = OpCmd(interp, nodes, litObjv);
- TclStackFree(interp); /* nodes */
- TclStackFree(interp); /* litObjv */
+ TclStackFree(interp, nodes);
+ TclStackFree(interp, litObjv);
}
return code;
}
@@ -2887,7 +2895,7 @@ TclVariadicOpCmd(
code = OpCmd(interp, nodes, objv+1);
- TclStackFree(interp); /* nodes */
+ TclStackFree(interp, nodes);
return code;
}