summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-12-06 10:25:57 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-12-06 10:25:57 (GMT)
commit85d4482f18637feeb6418a5935859a7423a2fc03 (patch)
tree77e719010fb565487d4aecd8a193c327fac7c0ff
parentd2cafa17fbc0ba124639514618fcdefecc66d927 (diff)
downloadtcl-85d4482f18637feeb6418a5935859a7423a2fc03.zip
tcl-85d4482f18637feeb6418a5935859a7423a2fc03.tar.gz
tcl-85d4482f18637feeb6418a5935859a7423a2fc03.tar.bz2
Fix [Bug 1845320] and [Bug 1845397]
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclCompCmds.c19
-rw-r--r--generic/tclNamesp.c3
3 files changed, 21 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index fb36948..79c2b52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-12-06 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tclCompCmds.c (TclCompileEnsemble): Ensure that the right
+ number of tokens are copied. [Bug 1845320]
+
+ * generic/tclNamesp.c (TclMakeEnsemble): Added missing release of a
+ DString. [Bug 1845397]
+
2007-12-05 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tclIO.h: Create Tcl_Obj for Tcl channels to reduce
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c47d4a1..4c13061 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.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: tclCompCmds.c,v 1.133 2007/12/03 13:46:28 dkf Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.134 2007/12/06 10:25:58 dkf Exp $
*/
#include "tclInt.h"
@@ -6098,7 +6098,10 @@ TclCompileVariableCmd(
*
* TclCompileEnsemble --
*
- * Procedure called to compile an ensemble command.
+ * Procedure called to compile an ensemble command. Note that most
+ * ensembles are not compiled, since modifying a compiled ensemble causes
+ * a invalidation of all existing bytecode (expensive!) which is not
+ * normally warranted.
*
* Results:
* Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
@@ -6145,8 +6148,8 @@ TclCompileEnsemble(
/*
* There's a sporting chance we'll be able to compile this. But now we
- * must check properly. To do that, check that we're compiling an
- * ensemble that has [info exists] as its appropriate subcommand.
+ * must check properly. To do that, check that we're compiling an ensemble
+ * that has a compilable command as its appropriate subcommand.
*/
if (Tcl_GetEnsembleMappingDict(NULL, ensemble, &mapObj) != TCL_OK
@@ -6326,8 +6329,8 @@ TclCompileEnsemble(
synthetic.tokenPtr = synthetic.staticTokens;
synthetic.tokensAvailable = NUM_STATIC_TOKENS;
} else {
- synthetic.tokenPtr = (Tcl_Token *)
- ckalloc(sizeof(Tcl_Token) * synthetic.numTokens);
+ synthetic.tokenPtr =
+ TclStackAlloc(interp, sizeof(Tcl_Token) * synthetic.numTokens);
synthetic.tokensAvailable = synthetic.numTokens;
}
@@ -6358,7 +6361,7 @@ TclCompileEnsemble(
*/
memcpy(synthetic.tokenPtr + 2, argTokensPtr,
- sizeof(Tcl_Token) * (synthetic.numTokens - 2));
+ sizeof(Tcl_Token) * (synthetic.numTokens - 2*len));
/*
* Hand off compilation to the subcommand compiler. At last!
@@ -6371,7 +6374,7 @@ TclCompileEnsemble(
*/
if (synthetic.tokenPtr != synthetic.staticTokens) {
- ckfree((char *) synthetic.tokenPtr);
+ TclStackFree(interp, synthetic.tokenPtr);
}
return result;
}
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index d4c12a8..22f3640 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.159 2007/11/28 16:50:27 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.160 2007/12/06 10:25:58 dkf Exp $
*/
#include "tclInt.h"
@@ -5964,6 +5964,7 @@ TclMakeEnsemble(
TCL_ENSEMBLE_PREFIX | ENSEMBLE_COMPILE);
}
}
+ Tcl_DStringFree(&buf);
return ensemble;
}