From bd06b22c9fa498d72808cebfa3987718288ce5db Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Jan 2019 10:18:46 +0000 Subject: use PublicInbox::Config::each_inbox where appropriate No need to reach into PublicInbox::Config internals and iterate through the hashref by hand --- script/public-inbox-index | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'script') diff --git a/script/public-inbox-index b/script/public-inbox-index index e487e3fe..73ad9bc4 100755 --- a/script/public-inbox-index +++ b/script/public-inbox-index @@ -73,16 +73,14 @@ if (@ARGV) { sub usage { print STDERR "Usage: $usage\n"; exit 1 } usage() unless @dirs; -foreach my $k (keys %$config) { - $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next; - my $name = $1; - my $v = $config->{$k}; +$config->each_inbox(sub { + my ($ibx) = @_; + for my $i (0..$#dirs) { - next if $dirs[$i] ne $v; - my $ibx = $config->lookup_name($name); - $dirs[$i] = $ibx if $ibx; + next if $dirs[$i] ne $ibx->{mainrepo}; + $dirs[$i] = $ibx; } -} +}); foreach my $dir (@dirs) { if (!ref($dir) && -f "$dir/inbox.lock") { # v2 -- cgit v1.2.3-24-ge0c7