The following commit has been merged in the master branch:
commit 15546b8caae13b6b0258d04e941847526153917a
Author: Raphael Geissert <[email protected]>
Date:   Sun Mar 1 18:21:09 2009 -0600

    Replace expensive m/^foo$/ regular expressions with a simple eq 'foo'

diff --git a/checks/binaries b/checks/binaries
index fb2fcda..9489f60 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -110,13 +110,13 @@ foreach my $file (sort keys %{$info->objdump_info}) {
        }
     }
     foreach (@{$objdump->{NOTES}}) {
-       if (m/^File format not recognized$/) {
+       if ($_ eq 'File format not recognized') {
             tag "apparently-corrupted-elf-binary", "$file";
-       } elsif (m/^File truncated$/) {
+       } elsif ($_ eq 'File truncated') {
             tag "apparently-truncated-elf-binary", "$file";
-       } elsif (m/^Packed with UPX$/) {
+       } elsif ($_ eq 'Packed with UPX') {
            tag "binary-file-compressed-with-upx", "$file";
-       } elsif (m/^Invalid operation$/) {
+       } elsif ($_ eq 'Invalid operation') {
            tag "binary-with-bad-dynamic-table", "$file" unless $file =~ 
m%^\./usr/lib/debug/%;
        }
     }
@@ -168,7 +168,7 @@ my %directories;
 foreach (sort keys %{$info->file_info}) {
     next unless length $_;
     my $data = $info->file_info->{$_};
-    next unless $data =~ /^directory$/ or $data =~ / link to /;
+    next unless $data eq 'directory' or $data =~ / link to /;
     $directories{"/$_"}++;
 }
 
diff --git a/checks/cruft b/checks/cruft
index af1879b..d4c671a 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -220,7 +220,7 @@ sub check_diffstat {
         }
 
         # Additional special checks only for the diff, not the full source.
-        if ($file =~ m,^debian/substvars$,) {
+        if ($file eq 'debian/substvars') {
             tag 'diff-contains-substvars', $file;
         }
     }
diff --git a/checks/debhelper b/checks/debhelper
index 60d8334..3cf4090 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -277,7 +277,7 @@ while (defined(my $file=readdir(DEBIAN))) {
                tag "maintainer-script-lacks-debhelper-token", "debian/$file";
            }
        }
-    } elsif ($file =~ m/^control$/) {
+    } elsif ($file eq 'control') {
        my $bdepends_noarch = $info->relation_noarch('build-depends-all');
         my $bdepends = $info->relation('build-depends-all');
         if ($needbuilddepends && ! $bdepends->implies('debhelper')) {
diff --git a/checks/manpages b/checks/manpages
index d633abf..3e10af5 100644
--- a/checks/manpages
+++ b/checks/manpages
@@ -51,14 +51,14 @@ foreach my $file (sort keys %{$info->index}) {
     # location of the binary, but there are too many mismatches between
     # bin/sbin and 1/8 that it's not clear it's the right thing to do.
     if (($perm =~ m,^[\-lh],o) and
-       (($path =~ m,^bin/$,o) or
-        ($path =~ m,^sbin/$,o) or
-        ($path =~ m,^usr/bin/$,o) or
-        ($path =~ m,^usr/bin/X11/$,o) or
-        ($path =~ m,^usr/bin/mh/$,o) or
-        ($path =~ m,^usr/sbin/$,o) or
-        ($path =~ m,^usr/games/$,o) or
-        ($path =~ m,^usr/X11R6/bin/$,o) )) {
+       (($path eq 'bin/') or
+        ($path eq 'sbin/') or
+        ($path eq 'usr/bin/') or
+        ($path eq 'usr/bin/X11/') or
+        ($path eq 'usr/bin/mh/') or
+        ($path eq 'usr/sbin/') or
+        ($path eq 'usr/games/') or
+        ($path eq 'usr/X11R6/bin/') )) {
 
        my $bin = $fname;
        $binary{$bin} = $file;
@@ -312,7 +312,7 @@ foreach my $file (sort keys %{$info->index}) {
                # regexes taken from checks/files
                tag "FSSTND-dir-in-manual-page", "$file:$lc $1";
            }
-           if ($line =~ m/^.SH "POD ERRORS"$/) {
+           if ($line eq '.SH "POD ERRORS"') {
                tag "manpage-has-errors-from-pod2man", "$file:$lc";
            }
        }
diff --git a/checks/shared-libs b/checks/shared-libs
index 4c0e870..8c32a4f 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -106,7 +106,7 @@ for my $cur_file (sort keys %{$info->index}) {
         }
 
        my @symbol_names = map { @{$_}[2] } @{$objdump->{$cur_file}->{SYMBOLS}};
-       if (grep /^_?exit$/, @symbol_names and !grep /^fork$/, @symbol_names) {
+       if (grep /^_?exit$/, @symbol_names and !grep $_ eq 'fork', 
@symbol_names) {
            tag "shlib-calls-exit", "$cur_file";
        }
 
diff --git a/checks/version-substvars b/checks/version-substvars
index 5aa0f8e..1082183 100644
--- a/checks/version-substvars
+++ b/checks/version-substvars
@@ -76,7 +76,7 @@ foreach (keys %$binpkgs) {
                                unless ($pkg2 =~ /\$\{\S+\}/);
                        next;
                }
-               $pkg2_is_any = ($info->binary_field($pkg2, 'architecture') !~ 
m/^all$/);
+               $pkg2_is_any = ($info->binary_field($pkg2, 'architecture') ne 
'all');
 
                if ($pkg1_is_any) {
                        if ($pkg2_is_any and $substvar_strips_binNMU) {

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to