summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorhershey <hershey>1999-06-15 03:14:44 (GMT)
committerhershey <hershey>1999-06-15 03:14:44 (GMT)
commit341ee3ff2ace23473a603c34c20809c1e8e2f1d4 (patch)
tree8ae3354a682760e414bd6306868fc7b8535ff9bd /generic/tclStringObj.c
parent73d440a8ed4e3ef4fd1c30ce5708061a261396dc (diff)
downloadtcl-341ee3ff2ace23473a603c34c20809c1e8e2f1d4.zip
tcl-341ee3ff2ace23473a603c34c20809c1e8e2f1d4.tar.gz
tcl-341ee3ff2ace23473a603c34c20809c1e8e2f1d4.tar.bz2
Improved the appendObj functions (uncomented the optimized code that was
present in the Unicode obj). Updated the teststringobj command to look in the correct location for the amount of space allocated for the UTF string rep. Note: one stringObj test is still failing; it reflects a change in that may not be undesirable...
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 8dc6e90..09cfc4c 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -31,7 +31,7 @@ A Unicode string
* 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.8 1999/06/15 01:16:25 hershey Exp $
+ * RCS: @(#) $Id: tclStringObj.c,v 1.9 1999/06/15 03:14:44 hershey Exp $
*/
#include "tclInt.h"
@@ -793,31 +793,18 @@ Tcl_AppendToObj(objPtr, bytes, length)
}
/*
- * TEMPORARY!!! This is terribly inefficient, but it works, and Don
- * needs for me to check this stuff in ASAP. -Melissa
- */
-
-/* printf("called Tcl_AppendToObj with str = %s\n", bytes); */
- UpdateStringOfString(objPtr);
- AppendUtfToUtfRep(objPtr, bytes, length);
- return;
-
- /*
* If objPtr has a valid Unicode rep, then append the Unicode
* conversion of "bytes" to the objPtr's Unicode rep, otherwise
* append "bytes" to objPtr's string rep.
*/
stringPtr = GET_STRING(objPtr);
- if (stringPtr->allocated > 0) {
+ if (stringPtr->uallocated > 0) {
AppendUtfToUnicodeRep(objPtr, bytes, length);
stringPtr = GET_STRING(objPtr);
-/* printf(" ended Tcl_AppendToObj with %d unicode chars.\n", */
-/* stringPtr->numChars); */
} else {
AppendUtfToUtfRep(objPtr, bytes, length);
-/* printf(" ended Tcl_AppendToObj with str = %s\n", objPtr->bytes); */
}
}
@@ -862,9 +849,9 @@ Tcl_AppendUnicodeToObj(objPtr, unicode, length)
* needs for me to check this stuff in ASAP. -Melissa
*/
- UpdateStringOfString(objPtr);
- AppendUnicodeToUtfRep(objPtr, unicode, length);
- return;
+/* UpdateStringOfString(objPtr); */
+/* AppendUnicodeToUtfRep(objPtr, unicode, length); */
+/* return; */
/*
* If objPtr has a valid Unicode rep, then append the "unicode"
@@ -873,7 +860,7 @@ Tcl_AppendUnicodeToObj(objPtr, unicode, length)
*/
stringPtr = GET_STRING(objPtr);
- if (stringPtr->allocated > 0) {
+ if (stringPtr->uallocated > 0) {
AppendUnicodeToUnicodeRep(objPtr, unicode, length);
} else {
AppendUnicodeToUtfRep(objPtr, unicode, length);
@@ -910,22 +897,12 @@ Tcl_AppendObjToObj(objPtr, appendObjPtr)
SetStringFromAny(NULL, objPtr);
/*
- * TEMPORARY!!! This is terribly inefficient, but it works, and Don
- * needs for me to check this stuff in ASAP. -Melissa
- */
-
- UpdateStringOfString(objPtr);
- bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
- AppendUtfToUtfRep(objPtr, bytes, length);
- return;
-
- /*
* If objPtr has a valid Unicode rep, then get a Unicode string
* from appendObjPtr and append it.
*/
stringPtr = GET_STRING(objPtr);
- if (stringPtr->allocated > 0) {
+ if (stringPtr->uallocated > 0) {
/*
* If appendObjPtr is not of the "String" type, don't convert it.
@@ -1047,7 +1024,6 @@ AppendUnicodeToUtfRep(objPtr, unicode, numChars)
int numChars; /* Number of chars of "unicode" to convert. */
{
Tcl_DString dsPtr;
- int length = numChars * sizeof(Tcl_UniChar);
char *bytes;
if (numChars == 0) {