diff options
author | das <das@noemail.net> | 2009-04-15 19:22:43 (GMT) |
---|---|---|
committer | das <das@noemail.net> | 2009-04-15 19:22:43 (GMT) |
commit | c5912754a750d4c706aacb9bf8304886fafaa69f (patch) | |
tree | 2aed9f620b2ce62a4170af6e9ff46a5dd240dc68 /generic/tclStringObj.c | |
parent | 153051bdd635dafa40de90b4e92802ebae3d5815 (diff) | |
download | tcl-c5912754a750d4c706aacb9bf8304886fafaa69f.zip tcl-c5912754a750d4c706aacb9bf8304886fafaa69f.tar.gz tcl-c5912754a750d4c706aacb9bf8304886fafaa69f.tar.bz2 |
UpdateStringOfString: matchup with core-8-5-branch changes
FossilOrigin-Name: 23808a5bdf26369cd6de257c3706c0751051d90e
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 12 |
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'; |