summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c19
1 files changed, 11 insertions, 8 deletions
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;
}