summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-08-27 15:12:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-08-27 15:12:38 (GMT)
commitd807bb087b7c5fdec280d68120900066bb8e05ae (patch)
tree705afa5dff7582b5ecb3c89460a5e5a99c490525
parentd679f070dcc31cea4f7fa392c47a081d7d926476 (diff)
downloadtcl-d807bb087b7c5fdec280d68120900066bb8e05ae.zip
tcl-d807bb087b7c5fdec280d68120900066bb8e05ae.tar.gz
tcl-d807bb087b7c5fdec280d68120900066bb8e05ae.tar.bz2
* generic/tclCompile.c: Move the deallocation of local LiteralTable
* generic/tclCompExpr.c: entries into TclFreeCompileEnv(). * generic/tclExecute.c: Update callers.
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclCompExpr.c5
-rw-r--r--generic/tclCompile.c14
-rw-r--r--generic/tclExecute.c12
4 files changed, 11 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d351ab..25cbc3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-08-27 Don Porter <dgp@users.sourceforge.net>
+ * generic/tclCompile.c: Move the deallocation of local LiteralTable
+ * generic/tclCompExpr.c: entries into TclFreeCompileEnv().
+ * generic/tclExecute.c: Update callers.
+
* generic/tclCompExpr.c: Force numeric and boolean literals
in expressions to register with their intreps intact, even if that
means overwriting existing intreps in already registered literals.
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index b0c9755..0d8a72e 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.81 2007/08/27 14:56:39 dgp Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.82 2007/08/27 15:12:38 dgp Exp $
*/
#include "tclInt.h"
@@ -2101,9 +2101,6 @@ ExecConstantExprTree(
TclEmitOpcode(INST_DONE, envPtr);
Tcl_IncrRefCount(byteCodeObj);
TclInitByteCodeObj(byteCodeObj, envPtr);
- if (envPtr->localLitTable.buckets != envPtr->localLitTable.staticBuckets) {
- ckfree((char *) envPtr->localLitTable.buckets);
- }
TclFreeCompileEnv(envPtr);
TclStackFree(interp, envPtr);
byteCodePtr = (ByteCode *) byteCodeObj->internalRep.otherValuePtr;
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index eaf8514..ab7d2ce 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.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: tclCompile.c,v 1.126 2007/08/24 11:22:51 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.127 2007/08/27 15:12:38 dgp Exp $
*/
#include "tclInt.h"
@@ -463,7 +463,6 @@ TclSetByteCodeFromAny(
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
- LiteralTable *localTablePtr = &(compEnv.localLitTable);
register AuxData *auxDataPtr;
LiteralEntry *entryPtr;
register int i;
@@ -545,13 +544,6 @@ TclSetByteCodeFromAny(
}
}
- /*
- * Free storage allocated during compilation.
- */
-
- if (localTablePtr->buckets != localTablePtr->staticBuckets) {
- ckfree((char *) localTablePtr->buckets);
- }
TclFreeCompileEnv(&compEnv);
return result;
}
@@ -989,6 +981,10 @@ void
TclFreeCompileEnv(
register CompileEnv *envPtr)/* Points to the CompileEnv structure. */
{
+ if (envPtr->localLitTable.buckets != envPtr->localLitTable.staticBuckets) {
+ ckfree((char *) envPtr->localLitTable.buckets);
+ envPtr->localLitTable.buckets = envPtr->localLitTable.staticBuckets;
+ }
if (envPtr->mallocedCodeArray) {
ckfree((char *) envPtr->codeStart);
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 625a7a0..3156450 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.324 2007/08/27 06:46:32 das Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.325 2007/08/27 15:12:38 dgp Exp $
*/
#include "tclInt.h"
@@ -1111,7 +1111,6 @@ Tcl_ExprObj(
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
- LiteralTable *localTablePtr = &(compEnv.localLitTable);
register ByteCode *codePtr = NULL;
/* Tcl Internal type of bytecode. Initialized
* to avoid compiler warning. */
@@ -1186,15 +1185,6 @@ Tcl_ExprObj(
TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0);
result = TclCompileExpr(interp, string, length, &compEnv);
- /*
- * Free the compilation environment's literal table bucket array if it
- * was dynamically allocated.
- */
-
- if (localTablePtr->buckets != localTablePtr->staticBuckets) {
- ckfree((char *) localTablePtr->buckets);
- }
-
if (result != TCL_OK) {
/*
* Compilation errors. Free storage allocated for compilation.