diff options
| author | dgp@users.sourceforge.net <dgp> | 2009-02-25 14:55:43 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2009-02-25 14:55:43 (GMT) |
| commit | 3f23b200effbbbd9e9d346efe7f23ce364960ac1 (patch) | |
| tree | 5efdf0ade44a52ff2cec1001265f6be0c578e345 /generic/tclExecute.c | |
| parent | 50f7d5f6d84c0b6c25d863851bd279c96d95192b (diff) | |
| download | tcl-3f23b200effbbbd9e9d346efe7f23ce364960ac1.zip tcl-3f23b200effbbbd9e9d346efe7f23ce364960ac1.tar.gz tcl-3f23b200effbbbd9e9d346efe7f23ce364960ac1.tar.bz2 | |
* generic/tclCmdMZ.c: Since Tcl_GetCharLength() has its own
* generic/tclExecute.c: optimizations for the tclByteArrayType, stop
having the callers do them.
Diffstat (limited to 'generic/tclExecute.c')
| -rw-r--r-- | generic/tclExecute.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ca4312a..e98545e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.427 2009/02/14 20:30:13 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.428 2009/02/25 14:56:07 dgp Exp $ */ #include "tclInt.h" @@ -4657,11 +4657,7 @@ TclExecuteByteCode( valuePtr = OBJ_AT_TOS; - if (valuePtr->typePtr == &tclByteArrayType) { - (void) Tcl_GetByteArrayFromObj(valuePtr, &length); - } else { - length = Tcl_GetCharLength(valuePtr); - } + length = Tcl_GetCharLength(valuePtr); TclNewIntObj(objResultPtr, length); TRACE(("%.20s => %d\n", O2S(valuePtr), length)); NEXT_INST_F(1, 1, 1); @@ -4681,21 +4677,9 @@ TclExecuteByteCode( valuePtr = OBJ_UNDER_TOS; /* - * If we have a ByteArray object, avoid indexing in the Utf string - * since the byte array contains one byte per character. Otherwise, - * use the Unicode string rep to get the index'th char. + * Get char length to calulate what 'end' means. */ - - if (valuePtr->typePtr == &tclByteArrayType) { - bytes = (char *)Tcl_GetByteArrayFromObj(valuePtr, &length); - } else { - /* - * Get Unicode char length to calulate what 'end' means. - */ - - length = Tcl_GetCharLength(valuePtr); - } - + length = Tcl_GetCharLength(valuePtr); result = TclGetIntForIndexM(interp, value2Ptr, length - 1, &index); if (result != TCL_OK) { goto checkForCatch; @@ -4703,8 +4687,8 @@ TclExecuteByteCode( if ((index >= 0) && (index < length)) { if (valuePtr->typePtr == &tclByteArrayType) { - objResultPtr = Tcl_NewByteArrayObj((unsigned char *) - (&bytes[index]), 1); + objResultPtr = Tcl_NewByteArrayObj( + Tcl_GetByteArrayFromObj(valuePtr, &length)+index, 1); } else if (valuePtr->bytes && length == valuePtr->length) { objResultPtr = Tcl_NewStringObj((const char *) (&valuePtr->bytes[index]), 1); |
