summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-09 19:13:48 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-09 19:13:48 (GMT)
commit18e7960200db745bdfb8936ed33e4cc7cafad557 (patch)
treefe34f4cb3f6cbebf555f06c923ffa88e4575e72d /generic/tclResult.c
parent6b3b5aaca5dae90f4def710e2f9d88684b039505 (diff)
downloadtcl-18e7960200db745bdfb8936ed33e4cc7cafad557.zip
tcl-18e7960200db745bdfb8936ed33e4cc7cafad557.tar.gz
tcl-18e7960200db745bdfb8936ed33e4cc7cafad557.tar.bz2
Same trouble fixed the same way in Tcl_AppendElement().
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r--generic/tclResult.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 7b58d44..1b9d5c9 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -704,6 +704,7 @@ Tcl_AppendElement(
char *dst;
int size;
int flags;
+ int quoteHash = 1;
/*
* If the string result is empty, move the object result to the string
@@ -740,9 +741,17 @@ Tcl_AppendElement(
* then this element will not lead a list, and need not have it's
* leading '#' quoted.
*/
-
+ quoteHash = 0;
+ } else {
+ while ((--dst >= iPtr->appendResult) && TclIsSpaceProcM(*dst)) {
+ }
+ quoteHash = !TclNeedSpace(iPtr->appendResult, dst+1);
+ }
+ dst = iPtr->appendResult + iPtr->appendUsed;
+ if (!quoteHash) {
flags |= TCL_DONT_QUOTE_HASH;
}
+
iPtr->appendUsed += Tcl_ConvertElement(element, dst, flags);
}