diff options
author | dgp <dgp@users.sourceforge.net> | 2009-02-15 23:13:11 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-02-15 23:13:11 (GMT) |
commit | 53a6c6e15b5a20bc8c7bb870aba701855f8da484 (patch) | |
tree | 1edcef987184945f8a7f58505afb8ae295520675 | |
parent | 6c361fffabf21b1adb6113a86da85c4dc64a9f9d (diff) | |
download | tcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.zip tcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.tar.gz tcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.tar.bz2 |
* generic/tclStringObj.c: Factor out duplicate code from
Tcl_AppendObjToObj.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | generic/tclStringObj.c | 16 |
2 files changed, 7 insertions, 12 deletions
@@ -1,5 +1,8 @@ 2009-02-15 Don Porter <dgp@users.sourceforge.net> + * 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); |