summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2009-04-15 19:22:44 (GMT)
committerdas <das>2009-04-15 19:22:44 (GMT)
commit552791038722b4588c2f0bc2da2dde3dadc15928 (patch)
tree2aed9f620b2ce62a4170af6e9ff46a5dd240dc68
parentc217dd3622ba6f95f77ca70cc8049c1a7256c58b (diff)
downloadtcl-552791038722b4588c2f0bc2da2dde3dadc15928.zip
tcl-552791038722b4588c2f0bc2da2dde3dadc15928.tar.gz
tcl-552791038722b4588c2f0bc2da2dde3dadc15928.tar.bz2
UpdateStringOfString: matchup with core-8-5-branch changes
-rw-r--r--generic/tclStringObj.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index aad8881..e6118c6 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.32.2.10 2009/04/15 19:11:07 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.32.2.11 2009/04/15 19:22:44 das Exp $ */
#include "tclInt.h"
@@ -1934,20 +1934,20 @@ UpdateStringOfString(objPtr)
}
size = 0;
- for (i = 0; i < stringPtr->numChars; i++) {
+ for (i = 0; i < stringPtr->numChars && size >= 0; i++) {
size += Tcl_UniCharToUtf((int) unicode[i], dummy);
}
if (size < 0) {
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
-
- dst = (char *) ckalloc((unsigned) (size + 1));
- objPtr->bytes = dst;
+
+ objPtr->bytes = (char *) ckalloc((unsigned) (size + 1));
objPtr->length = size;
stringPtr->allocated = size;
copyBytes:
- for (i = 0; i < stringPtr->numChars && size >= 0; i++) {
+ dst = objPtr->bytes;
+ for (i = 0; i < stringPtr->numChars; i++) {
dst += Tcl_UniCharToUtf(unicode[i], dst);
}
*dst = '\0';