diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-12-06 10:25:57 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-12-06 10:25:57 (GMT) |
commit | 85d4482f18637feeb6418a5935859a7423a2fc03 (patch) | |
tree | 77e719010fb565487d4aecd8a193c327fac7c0ff /generic | |
parent | d2cafa17fbc0ba124639514618fcdefecc66d927 (diff) | |
download | tcl-85d4482f18637feeb6418a5935859a7423a2fc03.zip tcl-85d4482f18637feeb6418a5935859a7423a2fc03.tar.gz tcl-85d4482f18637feeb6418a5935859a7423a2fc03.tar.bz2 |
Fix [Bug 1845320] and [Bug 1845397]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCompCmds.c | 19 | ||||
-rw-r--r-- | generic/tclNamesp.c | 3 |
2 files changed, 13 insertions, 9 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; } 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; } |