From da4f0d06bf46a3ce2f768e602066d711bb8b5ba7 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 16 Feb 2009 04:33:10 +0000 Subject: * generic/tclTestObj.c: Replace the [teststringobj ualloc] testing * tests/stringObj.test: command with [teststringobj maxchars] and update the tests. --- ChangeLog | 3 +++ generic/tclTestObj.c | 10 +++++----- tests/stringObj.test | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e01210a..f0d0e3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ number of Tcl_UniChars that may be stored in the allocated space. This reduces memory requirement a small bit, and makes some range checks simpler to code. + * generic/tclTestObj.c: Replace the [teststringobj ualloc] testing + * tests/stringObj.test: command with [teststringobj maxchars] and + update the tests. * generic/tclStringObj.c: Removed limitation in Tcl_AppendObjToObj where the char length of the result was only diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 55aec66..dba06f9 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -13,7 +13,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.33 2009/02/16 04:06:08 dgp Exp $ + * RCS: @(#) $Id: tclTestObj.c,v 1.34 2009/02/16 04:33:10 dgp Exp $ */ #include "tclInt.h" @@ -56,7 +56,7 @@ static int TeststringobjCmd(ClientData dummy, Tcl_Interp *interp, typedef struct TestString { int numChars; int allocated; - size_t uallocated; + int maxChars; Tcl_UniChar unicode[2]; } TestString; @@ -996,7 +996,7 @@ TeststringobjCmd( TestString *strPtr; static const char *const options[] = { "append", "appendstrings", "get", "get2", "length", "length2", - "set", "set2", "setlength", "ualloc", "getunicode", + "set", "set2", "setlength", "maxchars", "getunicode", "appendself", "appendself2", NULL }; @@ -1148,7 +1148,7 @@ TeststringobjCmd( Tcl_SetObjLength(varPtr[varIndex], length); } break; - case 9: /* ualloc */ + case 9: /* maxchars */ if (objc != 3) { goto wrongNumArgs; } @@ -1157,7 +1157,7 @@ TeststringobjCmd( Tcl_GetObjType("string")); strPtr = (TestString *) (varPtr[varIndex])->internalRep.otherValuePtr; - length = (int) strPtr->uallocated; + length = strPtr->maxChars; } else { length = -1; } diff --git a/tests/stringObj.test b/tests/stringObj.test index 7489df2..6b8e739 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -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: stringObj.test,v 1.19 2009/02/16 04:06:08 dgp Exp $ +# RCS: @(#) $Id: stringObj.test,v 1.20 2009/02/16 04:33:10 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -193,9 +193,9 @@ test stringObj-8.1 {DupStringInternalRep procedure} testobj { teststringobj append 1 abcde -1 testobj duplicate 1 2 list [teststringobj length 1] [teststringobj length2 1] \ - [teststringobj ualloc 1] [teststringobj get 1] \ + [teststringobj maxchars 1] [teststringobj get 1] \ [teststringobj length 2] [teststringobj length2 2] \ - [teststringobj ualloc 2] [teststringobj get 2] + [teststringobj maxchars 2] [teststringobj get 2] } {5 10 0 abcde 5 5 0 abcde} test stringObj-8.2 {DupUnicodeInternalRep, mixed width chars} testobj { set x abc\u00ef\u00bf\u00aeghi -- cgit v0.12