From 53a6c6e15b5a20bc8c7bb870aba701855f8da484 Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 15 Feb 2009 23:13:11 +0000 Subject: * generic/tclStringObj.c: Factor out duplicate code from Tcl_AppendObjToObj. --- ChangeLog | 3 +++ generic/tclStringObj.c | 16 ++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 969da70..2c22914 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-02-15 Don Porter + * generic/tclStringObj.c: Factor out duplicate code from + Tcl_AppendObjToObj. + * generic/tclStringObj.c: Replace the 'size_t uallocated' field of the String struct, storing the number of bytes allocated to store the Tcl_UniChar array, with an 'int maxChars' field, storing the diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index df4e9fc..1bfe70d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.107 2009/02/15 22:32:19 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.108 2009/02/15 23:13:11 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -1249,18 +1249,10 @@ Tcl_AppendObjToObj( */ if (appendObjPtr->typePtr == &tclStringType) { - stringPtr = GET_STRING(appendObjPtr); - if (stringPtr->hasUnicode == 0) { - /* - * If appendObjPtr is a string obj with no valid Unicode rep, - * then fill its unicode rep. - */ + Tcl_UniChar *unicode = + Tcl_GetUnicodeFromObj(appendObjPtr, &numChars); - FillUnicodeRep(appendObjPtr); - stringPtr = GET_STRING(appendObjPtr); - } - AppendUnicodeToUnicodeRep(objPtr, stringPtr->unicode, - stringPtr->numChars); + AppendUnicodeToUnicodeRep(objPtr, unicode, numChars); } else { bytes = TclGetStringFromObj(appendObjPtr, &length); AppendUtfToUnicodeRep(objPtr, bytes, length); -- cgit v0.12