From: Tom de Vries Date: Fri, 13 Feb 2026 14:49:53 +0000 (+0100) Subject: [gdb/testsuite] Simplify lib/quotemeta.exp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51b7445c65ff06a6d9740fc635be73287527a0a5;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Simplify lib/quotemeta.exp Simplify procs quotemeta and define_quotemeta using {}. --- diff --git a/gdb/testsuite/lib/quotemeta.exp b/gdb/testsuite/lib/quotemeta.exp index d2810e2c45b..c19ce962c2e 100644 --- a/gdb/testsuite/lib/quotemeta.exp +++ b/gdb/testsuite/lib/quotemeta.exp @@ -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" }