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

[SCM] Debian package checker branch, master, updated. 1.24.2-45-gc331420



The following commit has been merged in the master branch:
commit c331420ceb5ffa5f72ddffd59924c4435d7647b0
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date:   Wed Jul 30 00:02:10 2008 +0100

    Make index() return a hash rather than an array
    
    Make parsing of index() more consistent with objdump_info() and
    file_info() by returning a hash containing the file data

diff --git a/debian/changelog b/debian/changelog
index 8c6fba5..f260131 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -77,6 +77,7 @@ lintian (1.24.3) unstable; urgency=low
     + [ADB] When parsing objdump-info, indicate whether a shared object is
       an Ocaml executable.  Also add information on segments which various
       checks scripts use which hadn't made it here yet.
+    + [ADB] Make index() return a hash rather than an array
 
   * man/lintian.1
     + [ADB] Update the list of check scripts, removing the no longer present
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 7e59da5..a16f03d 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -49,7 +49,7 @@ sub index {
     my ($self) = @_;
     return $self->{index} if exists $self->{index};
 
-    my (@idx, %dir_counts);
+    my (%idx, %dir_counts);
     open my $idx, '<', "index"
         or fail("cannot open index file index: $!");
     open my $num_idx, '<', "index-owner-id"
@@ -88,14 +88,14 @@ sub index {
         $dir_counts{$1} = ($dir_counts{$1} || 0) + 1
             if $name =~ m,^(.+/)[^/]+/?$,;
 
-        push @idx, \%file;
+        $idx{$name} = \%file;
     }
-    foreach my $file (@idx) {
-        if ($dir_counts{$file->{name}}) {
-            $file->{count} = $dir_counts{$file->{name}};
+    foreach my $file (keys %idx) {
+        if ($dir_counts{$idx{$file}->{name}}) {
+            $idx{$file}->{count} = $dir_counts{$idx{$file}->{name}};
         }
     }
-    $self->{index} = \@idx;
+    $self->{index} = \%idx;
 
     return $self->{index};
 }

-- 
Debian package checker


Reply to: