From cd55adb09ee0d5e492e024cac7a43350933b9dd3 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 18 Sep 2009 21:13:40 +0000 Subject: * generic/tclCmdMZ.c (Tcl_SubstObj): Pass 'length' values to recursive parsing calls to convert O(N^2) operations of [subst] to O(N). --- ChangeLog | 6 ++++++ generic/tclCmdMZ.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b1281d..b3f8050 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-09-18 Don Porter + + * generic/tclCmdMZ.c (Tcl_SubstObj): Pass 'length' values to + recursive parsing calls to convert O(N^2) operations of [subst] + to O(N). + 2009-08-25 Andreas Kupries * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ef172fc..a082820 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.30 2009/08/25 20:59:10 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.31 2009/09/18 21:13:41 dgp Exp $ */ #include "tclInt.h" @@ -2623,7 +2623,7 @@ Tcl_SubstObj(interp, objPtr, flags) * unsubstituted characters straight through if a '$' * does not precede a variable name.) */ - if (Tcl_ParseVarName(interp, p, -1, &parse, 0) != TCL_OK) { + if (Tcl_ParseVarName(interp, p, length, &parse, 0) != TCL_OK) { goto errorResult; } if (parse.numTokens == 1) { @@ -2670,7 +2670,7 @@ Tcl_SubstObj(interp, objPtr, flags) iPtr->numLevels++; code = TclInterpReady(interp); if (code == TCL_OK) { - code = Tcl_EvalEx(interp, p+1, -1, 0); + code = Tcl_EvalEx(interp, p+1, length-1, 0); } iPtr->numLevels--; switch (code) { -- cgit v0.12