[debhelper-devel] [debhelper] 05/06: dh: Juggle some loops to move invariants out

Niels Thykier nthykier at moszumanska.debian.org
Mon Apr 10 17:39:29 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 96ef01d6107f5543d1ef08022d70f549e9848726
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Apr 10 17:08:55 2017 +0000

    dh: Juggle some loops to move invariants out
    
    It does not matter that much for actual performance, but it does seem
    like it under Devel::NYTProf.  By juggling these loops around, we
    avoid some minor unnecessary work and Devel::NYTProf now produces more
    accurate reports.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/dh b/dh
index 7661c4d..5114446 100755
--- a/dh
+++ b/dh
@@ -1043,22 +1043,23 @@ sub can_skip {
 	my @skipinfo=@{$skipinfo{$command}};
 	return 0 unless @skipinfo;
 
-	foreach my $package (@packages) {
-		foreach my $skipinfo (@skipinfo) {
-			if ($skipinfo=~/^([a-zA-Z0-9-_]+)\((.*)\)$/) {
-				my $type = $1;
-				my $need = $2;
-				if ($type eq 'tmp') {
+	foreach my $skipinfo (@skipinfo) {
+		if ($skipinfo=~/^([a-zA-Z0-9-_]+)\((.*)\)$/) {
+			my $type = $1;
+			my $need = $2;
+			if ($type eq 'tmp') {
+				foreach my $package (@packages) {
 					my $tmp = tmpdir($package);
 					return 0 if -e "$tmp/$need";
-				} else {
-					# Unknown hint - make no assumptions
-					return 0;
 				}
-			}
-			elsif (pkgfile($package, $skipinfo) ne '') {
+			} else {
+				# Unknown hint - make no assumptions
 				return 0;
 			}
+		} else {
+			foreach my $package (@packages) {
+				return 0 if pkgfile($package, $skipinfo) ne '';
+			}
 		}
 	}
 	return 1;

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




More information about the debhelper-devel mailing list