diff options
author | dgp <dgp@users.sourceforge.net> | 2016-10-27 19:39:49 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-10-27 19:39:49 (GMT) |
commit | ec332750d28a86537a3fc721decc3bb74d850dc9 (patch) | |
tree | 1265709e60aa38ed6a1ffd00d7660d9f17e13cce /generic/tclCmdMZ.c | |
parent | e4a82e14e114848e09bb17073c531eba791aacee (diff) | |
download | tcl-ec332750d28a86537a3fc721decc3bb74d850dc9.zip tcl-ec332750d28a86537a3fc721decc3bb74d850dc9.tar.gz tcl-ec332750d28a86537a3fc721decc3bb74d850dc9.tar.bz2 |
Start bringing all `string cat` operations into one place so it can be coded
correctly one time instead of badly multiple times.
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 591e31c..1a08674 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2855,7 +2855,7 @@ StringCatCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i; + int code; Tcl_Obj *objResultPtr; if (objc < 2) { @@ -2872,16 +2872,15 @@ StringCatCmd( Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } - objResultPtr = objv[1]; - if (Tcl_IsShared(objResultPtr)) { - objResultPtr = Tcl_DuplicateObj(objResultPtr); - } - for(i = 2;i < objc;i++) { - Tcl_AppendObjToObj(objResultPtr, objv[i]); + + code = TclStringCatObjv(interp, objc-1, objv+1, &objResultPtr); + + if (code == TCL_OK) { + Tcl_SetObjResult(interp, objResultPtr); + return TCL_OK; } - Tcl_SetObjResult(interp, objResultPtr); - return TCL_OK; + return code; } /* |