diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-15 19:55:16 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-15 19:55:16 (GMT) |
| commit | 1bcaf97bfdcfc794caf8606cf3da5ddac8bc02d6 (patch) | |
| tree | 7c1d8d3f8cf1b287cbf3d710de07c8be92afc08b /generic/tclStringObj.c | |
| parent | acb6a88df555fe8bdf2271bdbddb5fe19046b6c2 (diff) | |
| parent | ab6e69444f61e776bbfb2bcf6a6ca95047df149c (diff) | |
| download | tcl-1bcaf97bfdcfc794caf8606cf3da5ddac8bc02d6.zip tcl-1bcaf97bfdcfc794caf8606cf3da5ddac8bc02d6.tar.gz tcl-1bcaf97bfdcfc794caf8606cf3da5ddac8bc02d6.tar.bz2 | |
merge trunk
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 269131a..3e6f179 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); |
