From 1a49b000a0d9e7c09366f62d7ccbc904a45b6b68 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:31:47 +0000 Subject: pendingPtr == NULL implies (last == first) implies early out --- generic/tclStringObj.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be71109..847182d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov, *pendingPtr = NULL; + Tcl_Obj *objPtr, *objResultPtr, * const *ov; int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; @@ -2945,6 +2945,8 @@ TclStringCatObjv( } } while (--oc); } else { + Tcl_Obj *pendingPtr = NULL; + /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { @@ -2975,7 +2977,6 @@ TclStringCatObjv( } else { first = last; } - pendingPtr = NULL; } else { first = last; } @@ -3085,12 +3086,6 @@ TclStringCatObjv( objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); - if (pendingPtr) { - /* assert ( pendingPtr == objResultPtr ) */ - if ((length += start) < 0) { - goto overflow; - } - } if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3107,12 +3102,6 @@ TclStringCatObjv( /* Can't happen ? */ } } else { - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &start); - if ((length += start) < 0) { - goto overflow; - } - } objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { -- cgit v0.12