pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Tue Aug  9 18:42:40 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl

Log Message:
lintpkgsrc: clean up glob2regex


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.58 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.59
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.58 Tue Aug  9 18:35:43 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Tue Aug  9 18:42:40 2022
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.58 2022/08/09 18:35:43 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.59 2022/08/09 18:42:40 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -892,20 +892,17 @@ sub glob2regex($) {
                        $regex .= '\\+';
                } elsif ($_ eq '\\' && @chars > 0) {
                        my $next = shift @chars;
-                       $regex .= $next =~ /\w/ ? "$next" : "\\$next";
+                       $regex .= $next =~ /\w/ ? $next : "\\$next";
                } elsif ($_ eq '.' || $_ eq '|') {
-                       $regex .= quotemeta;
+                       $regex .= "\\$_";
                } elsif ($_ eq '{') {
                        $regex .= '(';
                        ++$alternative_depth;
                } elsif ($_ eq '}') {
-                       if ($alternative_depth == 0) {
-                               # Error
-                               return undef;
-                       }
+                       return undef if $alternative_depth == 0;
                        $regex .= ')';
                        --$alternative_depth;
-               } elsif ($_ eq ',' && $alternative_depth) {
+               } elsif ($_ eq ',' && $alternative_depth > 0) {
                        $regex .= '|';
                } elsif ($_ eq '[') {
                        $regex .= '[';



Home | Main Index | Thread Index | Old Index