diff options
author | dgp <dgp@users.sourceforge.net> | 2011-03-03 21:02:15 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-03-03 21:02:15 (GMT) |
commit | 892c4b94b1d6fc2283a0c2f9e1d5111db67553c1 (patch) | |
tree | 089c4a97fcf3d028d6ebc6c4fe0c51981f9beffd /generic/tclUtil.c | |
parent | 488806d8839d64b73f12bbd2fbdd514dfcf8e63f (diff) | |
download | tcl-892c4b94b1d6fc2283a0c2f9e1d5111db67553c1.zip tcl-892c4b94b1d6fc2283a0c2f9e1d5111db67553c1.tar.gz tcl-892c4b94b1d6fc2283a0c2f9e1d5111db67553c1.tar.bz2 |
Simplified the logic of the Scan/Convert pair of routines for generating
string reps of lists to stop using the unnecessary flag BRACES_UNMATCHED.
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index dcd2d5e..8296859 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -39,8 +39,6 @@ static ProcessGlobalValue executableName = { * USE_BRACES - 1 means the string contains a special * character that can be handled simply by * enclosing the entire argument in braces. - * BRACES_UNMATCHED - 1 means that braces aren't properly matched in - * the argument. * TCL_DONT_QUOTE_HASH - 1 means the caller insists that a leading hash * character ('#') should *not* be quoted. This * is appropriate when the caller can guarantee @@ -50,7 +48,6 @@ static ProcessGlobalValue executableName = { */ #define USE_BRACES 2 -#define BRACES_UNMATCHED 4 /* * The following key is used by Tcl_PrintDouble and TclPrecTraceProc to @@ -720,7 +717,7 @@ Tcl_ScanCountedElement( case '}': nestingLevel--; if (nestingLevel < 0) { - flags |= TCL_DONT_USE_BRACES|BRACES_UNMATCHED; + flags |= TCL_DONT_USE_BRACES; } break; case '[': @@ -736,7 +733,7 @@ Tcl_ScanCountedElement( break; case '\\': if ((p+1 == lastChar) || (p[1] == '\n')) { - flags = TCL_DONT_USE_BRACES | BRACES_UNMATCHED; + flags = TCL_DONT_USE_BRACES; } else { int size; @@ -748,7 +745,7 @@ Tcl_ScanCountedElement( } } if (nestingLevel != 0) { - flags = TCL_DONT_USE_BRACES | BRACES_UNMATCHED; + flags = TCL_DONT_USE_BRACES; } *flagPtr = flags; @@ -848,20 +845,7 @@ Tcl_ConvertCountedElement( *p = '}'; p++; } else { - if (*src == '{') { - /* - * Can't have a leading brace unless the whole element is enclosed - * in braces. Add a backslash before the brace. Furthermore, this - * may destroy the balance between open and close braces, so set - * BRACES_UNMATCHED. - */ - - p[0] = '\\'; - p[1] = '{'; - p += 2; - src++; - flags |= BRACES_UNMATCHED; - } else if ((*src == '#') && !(flags & TCL_DONT_QUOTE_HASH)) { + if ((*src == '#') && !(flags & TCL_DONT_QUOTE_HASH)) { /* * Leading '#' could be seen by [eval] as the start of a comment, * if on the first element of a list, so quote it. @@ -895,7 +879,7 @@ Tcl_ConvertCountedElement( * backslashed. */ - if (flags & BRACES_UNMATCHED) { + if (flags & TCL_DONT_USE_BRACES) { *p = '\\'; p++; } |