summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-11-09 16:42:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-11-09 16:42:37 (GMT)
commitd16fc1a584edbda22d31fb06b50f3fe78439cdf2 (patch)
tree937b1d31c0a24dbb98634178dc78b7dea9b9daa8 /generic/tclUtil.c
parent13446e004af0e7e4579070f7a39b9b48b7500185 (diff)
downloadtcl-d16fc1a584edbda22d31fb06b50f3fe78439cdf2.zip
tcl-d16fc1a584edbda22d31fb06b50f3fe78439cdf2.tar.gz
tcl-d16fc1a584edbda22d31fb06b50f3fe78439cdf2.tar.bz2
[35a8f1c04a] Fix bad lengths when creating string rep of some lists.
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 6eab7b8..d5cc7c2 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1046,6 +1046,23 @@ TclScanElement(
return 2;
}
+#if COMPAT
+ /*
+ * We have an established history in TclConvertElement() when quoting
+ * because of a leading hash character to force what would be the
+ * CONVERT_MASK mode into the CONVERT_BRACE mode. That is, we format
+ * the element #{a"b} like this:
+ * {#{a"b}}
+ * and not like this:
+ * \#{a\"b}
+ * This is inconsistent with [list x{a"b}], but we will not change that now.
+ * Set that preference here so that we compute a tight size requirement.
+ */
+ if ((*src == '#') && !(*flagPtr & TCL_DONT_QUOTE_HASH)) {
+ preferBrace = 1;
+ }
+#endif
+
if ((*p == '{') || (*p == '"')) {
/*
* Must escape or protect so leading character of value is not