From 8de616ebaa9b5992be55b8d4c3af38f1b88b6faa Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Mon, 4 Feb 2008 19:54:33 +0000 Subject: * generic/tclExecute.c (INST_CONCAT1): fix optimisation for in-place concatenation (was going over String type) --- ChangeLog | 5 +++++ generic/tclExecute.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1a4bf2..f284785 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-04 Miguel Sofer + + * generic/tclExecute.c (INST_CONCAT1): fix optimisation for + in-place concatenation (was going over String type) + 2008-02-04 Don Porter *** 8.5.1 TAGGED FOR RELEASE *** diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 726b585..3439fc8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -13,7 +13,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.361 2008/01/23 21:21:31 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.362 2008/02/04 19:54:34 msofer Exp $ */ #include "tclInt.h" @@ -2059,8 +2059,11 @@ TclExecuteByteCode( objResultPtr = OBJ_AT_DEPTH(opnd-1); bytes = TclGetStringFromObj(objResultPtr, &length); #if !TCL_COMPILE_DEBUG - if (!Tcl_IsShared(objResultPtr)) { - Tcl_SetObjLength(objResultPtr, (length + appendLen)); + if (bytes != tclEmptyStringRep && !Tcl_IsShared(objResultPtr)) { + TclFreeIntRep(objResultPtr); + objResultPtr->typePtr = NULL; + objResultPtr->bytes = ckrealloc(bytes, (length + appendLen + 1)); + objResultPtr->length = length + appendLen; p = TclGetString(objResultPtr) + length; currPtr = &OBJ_AT_DEPTH(opnd - 2); } else { -- cgit v0.12