diff options
author | dgp <dgp@users.sourceforge.net> | 2017-06-16 16:23:22 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-06-16 16:23:22 (GMT) |
commit | 5425edf173bf9efcf17955623e5be64196eae2fa (patch) | |
tree | 344f4ecda51afdc4a46378e625803b492d09236f | |
parent | 58311abbb709a5255f685e5d45ae837b0e9c7251 (diff) | |
download | tcl-5425edf173bf9efcf17955623e5be64196eae2fa.zip tcl-5425edf173bf9efcf17955623e5be64196eae2fa.tar.gz tcl-5425edf173bf9efcf17955623e5be64196eae2fa.tar.bz2 |
Simplify the final loop when we know we're generating strings for all.
-rw-r--r-- | generic/tclStringObj.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be686cf..51d6c13 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3007,48 +3007,22 @@ TclStringCatObjv( --oc; } - if (oc) { - - /* assert ( length > 0 ) */ - - - do { + while (oc) { int numBytes; - Tcl_Obj *objPtr = *ov++; - if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { - /* No string rep; Take the chance we can avoid making it */ + /* assert ( length > 0 && pendingPtr == NULL ) */ + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes) { last = objc - oc; - first = last; - pendingPtr = objPtr; - } else { - - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes) { - last = objc - oc; - } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { - continue; - } - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - pendingPtr = NULL; - } - if (length == 0) { - if (numBytes) { - first = last; - } else { - first = objc - 1; - last = 0; - } - } else if (numBytes > INT_MAX - length) { + if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } - } while (--oc); - } + --oc; + } } if (last <= first /*|| length == 0 */) { |