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

[lintian] 06/08: c/control-file.pm: Do a minor common-case optimisation



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit aebe4f808287a3ef209bfec5939ec3ade3241d57
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Mar 25 19:48:02 2014 +0100

    c/control-file.pm: Do a minor common-case optimisation
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/control-file.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/checks/control-file.pm b/checks/control-file.pm
index f958ee5..3eb2272 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -300,12 +300,16 @@ sub run {
 
     # check which profile names are supposedly supported according to the build
     # dependencies
-    my %used_profiles=();
+    my %used_profiles;
     for my $field (
         qw(build-depends build-depends-indep build-conflicts build-conflicts-indep)
       ) {
-        if (defined $info->source_field($field)) {
-            for my $dep (split /\s*,\s*/, $info->source_field($field)) {
+        if (my $value = $info->source_field($field)) {
+            # If the field does not contain "profile." then skip this
+            # part.  They rarely do, so this is just a little
+            # "common-case" optimisation.
+            next if index($value, 'profile.') < 0;
+            for my $dep (split /\s*,\s*/, $value) {
                 for my $alt (split /\s*\|\s*/, $dep) {
                     while ($alt =~ /<([^>]+)>/g) {
                         for my $restr (split /\s+/, $1) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: