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=af29c98849dc22093418a957925456bef115722f

commit af29c98849dc22093418a957925456bef115722f
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Sep 30 02:09:11 2022 +0200

    Dpkg::Vendor: Avoid duplicate file loading attempts
    
    When loading either the vendor file or the vendor module, only try the
    same name once, by removing duplicates from the list. Otherwise we are
    performing wasteful operations, that will affect all callers that have
    conditional vendor support.
---
 scripts/Dpkg/Vendor.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm
index abfa926db..8319f801b 100644
--- a/scripts/Dpkg/Vendor.pm
+++ b/scripts/Dpkg/Vendor.pm
@@ -30,6 +30,7 @@ our @EXPORT_OK = qw(
 );
 
 use Exporter qw(import);
+use List::Util qw(uniq);
 
 use Dpkg ();
 use Dpkg::ErrorHandling;
@@ -118,7 +119,7 @@ sub get_vendor_file(;$) {
     if ($vendor =~ s/\s+/-/) {
         push @names, $vendor, lc($vendor), ucfirst($vendor), 
ucfirst(lc($vendor));
     }
-    foreach my $name (@names) {
+    foreach my $name (uniq @names) {
         next unless -e "$origins/$name";
         return "$origins/$name";
     }
@@ -161,7 +162,7 @@ sub get_vendor_object {
     my ($obj, @names);
     push @names, $vendor, lc($vendor), ucfirst($vendor), ucfirst(lc($vendor));
 
-    foreach my $name (@names) {
+    foreach my $name (uniq @names) {
         eval qq{
             pop \@INC if \$INC[-1] eq '.';
             require Dpkg::Vendor::$name;

-- 
Dpkg.Org's dpkg

Reply via email to