diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-15 12:55:59 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-15 12:55:59 (GMT) |
| commit | c576cbec93fdeaba19970c8f94a26d68c9cc4454 (patch) | |
| tree | 7c4312eacbc921feb888e783a5537487d0b884a3 /generic/tclStringObj.c | |
| parent | a69614b432b2cf0d9fdeb9afcff304bad9b9e51e (diff) | |
| parent | 556dc3036e36d2449fe4feaece94487adfd745b8 (diff) | |
| download | tcl-c576cbec93fdeaba19970c8f94a26d68c9cc4454.zip tcl-c576cbec93fdeaba19970c8f94a26d68c9cc4454.tar.gz tcl-c576cbec93fdeaba19970c8f94a26d68c9cc4454.tar.bz2 | |
merge core-8-branch. Fully functioning now, including with the new vc-reform implementation.
Diffstat (limited to 'generic/tclStringObj.c')
| -rw-r--r-- | generic/tclStringObj.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 85cac83..385ce4f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -421,13 +421,14 @@ Tcl_GetCharLength( * Optimize the case where we're really dealing with a bytearray object; * we don't need to convert to a string to perform the get-length operation. * - * NOTE that we do not need the bytearray to be "pure". A ByteArray value - * with a string rep cannot be trusted to represent the same value as the - * string rep, but it *can* be trusted to have the same character length - * as the string rep, which is all this routine cares about. + * Starting in Tcl 8.7, we check for a "pure" bytearray, because the + * machinery behind that test is using a proper bytearray ObjType. We + * could also compute length of an improper bytearray without shimmering + * but there's no value in that. We *want* to shimmer an improper bytearray + * because improper bytearrays have worthless internal reps. */ - if (objPtr->typePtr == &tclByteArrayType) { + if (TclIsPureByteArray(objPtr)) { int length; (void) Tcl_GetByteArrayFromObj(objPtr, &length); |
