summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-10-28 15:47:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-10-28 15:47:07 (GMT)
commit008dd7e2517ec526af573528879663f392bc3ac3 (patch)
treebe7d1991e0f10f10d66a0ae34b8e10e54f100555
parenta9497530c8d6a3166c99286d27718957d5962261 (diff)
parentdff4ed85a2e6fac50d5e9d7caee4a7f1dffcd835 (diff)
downloadtcl-008dd7e2517ec526af573528879663f392bc3ac3.zip
tcl-008dd7e2517ec526af573528879663f392bc3ac3.tar.gz
tcl-008dd7e2517ec526af573528879663f392bc3ac3.tar.bz2
merge trunk
-rw-r--r--generic/tclDictObj.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 428173d..f99f984 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -2305,17 +2305,26 @@ DictAppendCmd(
return TCL_ERROR;
}
- if (valuePtr == NULL) {
- TclNewObj(valuePtr);
- } else if (Tcl_IsShared(valuePtr)) {
- valuePtr = Tcl_DuplicateObj(valuePtr);
- }
+ if ((objc > 3) || (valuePtr == NULL)) {
+ /* Only go through append activites when something will change. */
+
+ if (valuePtr == NULL) {
+ TclNewObj(valuePtr);
+ } else if (Tcl_IsShared(valuePtr)) {
+ valuePtr = Tcl_DuplicateObj(valuePtr);
+ }
- for (i=3 ; i<objc ; i++) {
- Tcl_AppendObjToObj(valuePtr, objv[i]);
+ for (i=3 ; i<objc ; i++) {
+ Tcl_AppendObjToObj(valuePtr, objv[i]);
+ }
+
+ Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr);
}
- Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr);
+ /*
+ * Even if nothing changed, we still overwrite so that variable
+ * trace expectations are met.
+ */
resultPtr = Tcl_ObjSetVar2(interp, objv[1], NULL, dictPtr,
TCL_LEAVE_ERR_MSG);