]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Simplify lib/quotemeta.exp
authorTom de Vries <tdevries@suse.de>
Fri, 13 Feb 2026 14:49:53 +0000 (15:49 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 13 Feb 2026 14:49:53 +0000 (15:49 +0100)
Simplify procs quotemeta and define_quotemeta using {}.

gdb/testsuite/lib/quotemeta.exp

index d2810e2c45bc81bc4f754683cb07df82166a2d5a..c19ce962c2e1517317eab58967814af914d2e591 100644 (file)
@@ -66,7 +66,7 @@ proc quotemeta {str} {
     # expression.  I.e., "@/...@.../" is valid.  This lets users avoid
     # excess quoting.
     while true {
-       regexp -- "^(\[^@\]*)(@(.*))?$" $str ignore prefix full_at at_text
+       regexp -- {^([^@]*)(@(.*))?$} $str ignore prefix full_at at_text
        append result [string_to_regexp $prefix]
        if {$full_at == ""} {
            # No more substitutions, we're done.
@@ -83,7 +83,7 @@ proc quotemeta {str} {
            }
        } else {
            # Match the usual forms.
-           if {![regexp -- "^(\\.\\.\\.|\[A-Z\]\[A-Z_\]*|@|/\[^/\]*/)(.*)$" \
+           if {![regexp -- {^(\.\.\.|[A-Z][A-Z_]*|@|/[^/]*/)(.*)$} \
                      $at_text ignore at_text remainder]} {
                error "invalid quotemeta expression @$at_text"
            }
@@ -112,7 +112,7 @@ proc quotemeta {str} {
     # Now replace any whitespace with a regular expression that will
     # match any amount of whitespace.  This is done after constructing
     # the regular expression so we don't regexp-quote the \s+.
-    return [regsub -all -- "\\s+" $result "\\\\s+"]
+    return [regsub -all -- {\s+} $result {\s+}]
 }
 
 # Define a new quotemeta substitution.
@@ -125,7 +125,7 @@ proc quotemeta {str} {
 # RX is the regular expression that is used to implement the matching
 # for this name.
 proc define_quotemeta {name rx} {
-    if {![regexp -- "^\[A-Z\]\[A-Z_\]*$" $name]} {
+    if {![regexp -- {^[A-Z][A-Z_]*$} $name]} {
        error "bad quotemeta name"
     }