diff options
author | hobbs <hobbs@noemail.net> | 1999-12-12 02:26:39 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 1999-12-12 02:26:39 (GMT) |
commit | ded8a2cf0836a3f855ec0cd31696fcd17035d0cf (patch) | |
tree | a0669e049fc8824bf3b37835e2244bac6c56a8d8 /generic/tclUtil.c | |
parent | 0f57f0dd9f6fb910fd94faf32ef90f7458c35c53 (diff) | |
download | tcl-ded8a2cf0836a3f855ec0cd31696fcd17035d0cf.zip tcl-ded8a2cf0836a3f855ec0cd31696fcd17035d0cf.tar.gz tcl-ded8a2cf0836a3f855ec0cd31696fcd17035d0cf.tar.bz2 |
* tests/var.test:
* generic/tclCompile.c: fixed problem where setting to {} array
would intermittently not work. (Fontaine) [Bug: 3339]
* generic/tclCmdMZ.c:
* generic/tclExecute.c: optimized INST_TRY_CVT_TO_NUMERIC to
recognize boolean objects. (Spjuth) [Bug: 2815]
* tests/info.test:
* tests/parseOld.test:
* generic/tclCmdAH.c:
* generic/tclProc.c: changed Tcl_UplevelObjCmd (uplevel) and
Tcl_EvalObjCmd (eval) to use TCL_EVAL_DIRECT in the single arg
case as well, to take advantage of potential pure list input
optimization. This means that it won't get byte compiled though,
which should be acceptable.
* generic/tclBasic.c: made Tcl_EvalObjEx pure list object aware in
the TCL_EVAL_DIRECT case for efficiency.
* generic/tclUtil.c: made Tcl_ConcatObj pure list object aware,
and return a list object in that case [Bug: 2098 2257]
* generic/tclMain.c: changed Tcl_Main to not constantly reuse the
commandPtr object (interactive case) as it could be shared. (Fellows)
FossilOrigin-Name: a887ecceee0733a287a08841a1099a4d75809d6d
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index da38b97..6e99f32 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.16 1999/12/08 03:49:52 hobbs Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.17 1999/12/12 02:26:43 hobbs Exp $ */ #include "tclInt.h" @@ -1005,6 +1005,38 @@ Tcl_ConcatObj(objc, objv) char *concatStr; Tcl_Obj *objPtr; + /* + * Check first to see if all the items are of list type. If so, + * we will concat them together as lists, and return a list object. + * This is only valid when the lists have no current string + * representation, since we don't know what the original type was. + * An original string rep may have lost some whitespace info when + * converted which could be important. + */ + for (i = 0; i < objc; i++) { + objPtr = objv[i]; + if ((objPtr->typePtr != &tclListType) || (objPtr->bytes != NULL)) { + break; + } + } + if (i == objc) { + Tcl_Obj **listv; + int listc; + + objPtr = Tcl_NewListObj(0, NULL); + for (i = 0; i < objc; i++) { + /* + * Tcl_ListObjAppendList could be used here, but this saves + * us a bit of type checking (since we've already done it) + * Use of INT_MAX tells us to always put the new stuff on + * the end. It will be set right in Tcl_ListObjReplace. + */ + Tcl_ListObjGetElements(NULL, objv[i], &listc, &listv); + Tcl_ListObjReplace(NULL, objPtr, INT_MAX, 0, listc, listv); + } + return objPtr; + } + allocSize = 0; for (i = 0; i < objc; i++) { objPtr = objv[i]; |