summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.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/tclTestObj.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/tclTestObj.c')
-rw-r--r--generic/tclTestObj.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 533b967..259fcbd 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTestObj.c,v 1.4 1999/06/08 02:59:26 hershey Exp $
+ * RCS: @(#) $Id: tclTestObj.c,v 1.5 1999/06/15 03:14:45 hershey Exp $
*/
#include "tclInt.h"
@@ -58,6 +58,14 @@ static int TestobjCmd _ANSI_ARGS_((ClientData dummy,
static int TeststringobjCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]));
+
+typedef struct TestString {
+ int numChars;
+ size_t allocated;
+ size_t uallocated;
+ Tcl_UniChar unicode[2];
+} TestString;
+
/*
*----------------------------------------------------------------------
@@ -872,6 +880,7 @@ TeststringobjCmd(clientData, interp, objc, objv)
int varIndex, option, i, length;
#define MAX_STRINGS 11
char *index, *string, *strings[MAX_STRINGS+1];
+ TestString *strPtr;
static char *options[] = {
"append", "appendstrings", "get", "get2", "length", "length2",
"set", "set2", "setlength", (char *) NULL
@@ -974,8 +983,14 @@ TeststringobjCmd(clientData, interp, objc, objv)
if (objc != 3) {
goto wrongNumArgs;
}
- Tcl_SetIntObj(Tcl_GetObjResult(interp), (varPtr[varIndex] != NULL)
- ? (int) varPtr[varIndex]->internalRep.longValue : -1);
+ if (varPtr[varIndex] != NULL) {
+ strPtr = (TestString *)
+ (varPtr[varIndex])->internalRep.otherValuePtr;
+ length = (int) strPtr->allocated;
+ } else {
+ length = -1;
+ }
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), length);
break;
case 6: /* set */
if (objc != 4) {