summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-02-12 17:08:44 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-02-12 17:08:44 (GMT)
commitebd799b7e4d40a843ff6c49f8fc77670acf6b67a (patch)
treed29a8a37a32403308269023653e87f973e40cb41 /generic/tclTestObj.c
parent50707cc831683d99d683b35c712cdbb238ffa2d2 (diff)
downloadtcl-ebd799b7e4d40a843ff6c49f8fc77670acf6b67a.zip
tcl-ebd799b7e4d40a843ff6c49f8fc77670acf6b67a.tar.gz
tcl-ebd799b7e4d40a843ff6c49f8fc77670acf6b67a.tar.bz2
* generic/tclStringObj.c: Simplified Tcl_GetCharLength by
* generic/tclTestObj.c: removing code that did nothing. Added early returns from Tcl_*SetObjLength when the desired length is already present; adapted test command to the change.
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r--generic/tclTestObj.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 73cca56..524f05a 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.30 2009/02/11 18:07:56 dgp Exp $
+ * RCS: @(#) $Id: tclTestObj.c,v 1.31 2009/02/12 17:08:45 dgp Exp $
*/
#include "tclInt.h"
@@ -1096,6 +1096,9 @@ TeststringobjCmd(
goto wrongNumArgs;
}
if (varPtr[varIndex] != NULL) {
+ if ((varPtr[varIndex])->typePtr != &tclStringType) {
+ Tcl_ConvertToType(NULL, varPtr[varIndex], &tclStringType);
+ }
strPtr = (TestString *)
(varPtr[varIndex])->internalRep.otherValuePtr;
length = (int) strPtr->allocated;
@@ -1149,6 +1152,9 @@ TeststringobjCmd(
goto wrongNumArgs;
}
if (varPtr[varIndex] != NULL) {
+ if ((varPtr[varIndex])->typePtr != &tclStringType) {
+ Tcl_ConvertToType(NULL, varPtr[varIndex], &tclStringType);
+ }
strPtr = (TestString *)
(varPtr[varIndex])->internalRep.otherValuePtr;
length = (int) strPtr->uallocated;