summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-06-16 11:47:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-06-16 11:47:46 (GMT)
commitbcc916d762591d6fae72ea0ba0ac0c747bcc0173 (patch)
tree39295604b05fd36f20fda2366eaadc4bb8d9816a
parent1937d9e35787b2a3d0711a4b166ff4e3f582b6e2 (diff)
downloadtcl-bcc916d762591d6fae72ea0ba0ac0c747bcc0173.zip
tcl-bcc916d762591d6fae72ea0ba0ac0c747bcc0173.tar.gz
tcl-bcc916d762591d6fae72ea0ba0ac0c747bcc0173.tar.bz2
Better define the meaning of "first" and "last".
-rw-r--r--generic/tclStringObj.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index aa99545..0a38836 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2848,8 +2848,10 @@ TclStringCatObjv(
Tcl_Obj **objPtrPtr)
{
Tcl_Obj *objPtr, *objResultPtr, * const *ov;
- int oc, length = 0, binary = 1, first = 0, last = 0;
+ int oc, length = 0, binary = 1;
int allowUniChar = 1, requestUniChar = 0;
+ int first = objc - 1; /* Index of first value possibly not empty */
+ int last = 0; /* Index of last value possibly not empty */
/* assert ( objc >= 0 ) */
@@ -2981,9 +2983,9 @@ TclStringCatObjv(
} while (--oc);
}
- if (last == first /*|| length == 0 */) {
+ if (last <= first /*|| length == 0 */) {
/* Only one non-empty value or zero length; return first */
- /* NOTE: (length == 0) implies (last == first) */
+ /* NOTE: (length == 0) implies (last <= first) */
*objPtrPtr = objv[first];
return TCL_OK;
}