This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=544af6f0b7ce9d607e886a7186d3cc22830cea45 commit 544af6f0b7ce9d607e886a7186d3cc22830cea45 Author: Guillem Jover <[email protected]> AuthorDate: Wed Sep 21 03:39:46 2022 +0200 Dpkg::Vendor: Fix get_vendor_file() to return on first match There is no point in checking the whole list of alternative vendor files just to return the last match, when we can simply return early on the first, as that's all wasted work. This also makes the behavior consistent with the get_vendor_object which returns on the first match when looking for a perl module. Reported-by: Niels Thykier <[email protected]> (on IRC) --- scripts/Dpkg/Vendor.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm index 85cf296c2..abfa926db 100644 --- a/scripts/Dpkg/Vendor.pm +++ b/scripts/Dpkg/Vendor.pm @@ -113,15 +113,16 @@ name. sub get_vendor_file(;$) { my $vendor = shift || 'default'; - my $file; + my @names = ($vendor, lc($vendor), ucfirst($vendor), ucfirst(lc($vendor))); if ($vendor =~ s/\s+/-/) { push @names, $vendor, lc($vendor), ucfirst($vendor), ucfirst(lc($vendor)); } foreach my $name (@names) { - $file = "$origins/$name" if -e "$origins/$name"; + next unless -e "$origins/$name"; + return "$origins/$name"; } - return $file; + return; } =item $name = get_current_vendor() -- Dpkg.Org's dpkg

