Tcl Source Code

Artifact [19dc2b073d]
Login

Artifact 19dc2b073dc2c21a7ae22ba58ba423e15dbd87eb:

Attachment "3173086.patch" to ticket [3173086fff] added by dgp 2011-02-15 02:46:47.
Index: generic/tclUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
retrieving revision 1.97.2.10
diff -u -r1.97.2.10 tclUtil.c
--- generic/tclUtil.c	15 Jan 2011 19:07:01 -0000	1.97.2.10
+++ generic/tclUtil.c	14 Feb 2011 19:45:25 -0000
@@ -41,8 +41,6 @@
  * 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
@@ -52,7 +50,6 @@
  */
 
 #define USE_BRACES		2
-#define BRACES_UNMATCHED	4
 
 /*
  * The following key is used by Tcl_PrintDouble and TclPrecTraceProc to
@@ -722,7 +719,7 @@
 	case '}':
 	    nestingLevel--;
 	    if (nestingLevel < 0) {
-		flags |= TCL_DONT_USE_BRACES|BRACES_UNMATCHED;
+		flags |= TCL_DONT_USE_BRACES;
 	    }
 	    break;
 	case '[':
@@ -738,7 +735,7 @@
 	    break;
 	case '\\':
 	    if ((p+1 == lastChar) || (p[1] == '\n')) {
-		flags = TCL_DONT_USE_BRACES | BRACES_UNMATCHED;
+		flags = TCL_DONT_USE_BRACES;
 	    } else {
 		int size;
 
@@ -750,7 +747,7 @@
 	}
     }
     if (nestingLevel != 0) {
-	flags = TCL_DONT_USE_BRACES | BRACES_UNMATCHED;
+	flags = TCL_DONT_USE_BRACES;
     }
     *flagPtr = flags;
 
@@ -850,20 +847,7 @@
 	*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.
@@ -897,7 +881,7 @@
 		 * backslashed.
 		 */
 
-		if (flags & BRACES_UNMATCHED) {
+		if (flags & TCL_DONT_USE_BRACES) {
 		    *p = '\\';
 		    p++;
 		}