summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-02-15 23:13:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-02-15 23:13:11 (GMT)
commit53a6c6e15b5a20bc8c7bb870aba701855f8da484 (patch)
tree1edcef987184945f8a7f58505afb8ae295520675
parent6c361fffabf21b1adb6113a86da85c4dc64a9f9d (diff)
downloadtcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.zip
tcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.tar.gz
tcl-53a6c6e15b5a20bc8c7bb870aba701855f8da484.tar.bz2
* generic/tclStringObj.c: Factor out duplicate code from
Tcl_AppendObjToObj.
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclStringObj.c16
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 <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);