[lintian] 01/15: L::L::Manifest: Remove first argument to _do_{g, s}et
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 4bb3a0fed4143d50f7b0da12130793a5e95651eb
Author: Niels Thykier <niels@thykier.net>
Date: Wed Feb 5 22:36:32 2014 +0100
L::L::Manifest: Remove first argument to _do_{g,s}et
It is almost always the same and can be computed within _do_get and
_do_set. The only exception is _do_read_file where the argument was
still required for _do_set. Here is now passed as last (optional)
argument.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
lib/Lintian/Lab/Manifest.pm | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/Lintian/Lab/Manifest.pm b/lib/Lintian/Lab/Manifest.pm
index 277669e..762222b 100644
--- a/lib/Lintian/Lab/Manifest.pm
+++ b/lib/Lintian/Lab/Manifest.pm
@@ -262,7 +262,7 @@ sub visit_all {
my (undef, undef, $qf) = $self->_type_to_fields;
if (@keys) {
- $root = $self->_do_get($self->{'state'}, @keys);
+ $root = $self->_do_get(@keys);
return unless $root;
if (scalar @$qf == scalar @keys) {
# If we are given an exact match, just visit that and
@@ -303,7 +303,7 @@ except for source packages
sub get {
my ($self, @keys) = @_;
@keys = $self->_make_keys($keys[0]) if scalar @keys == 1;
- return $self->_do_get($self->{'state'}, @keys);
+ return $self->_do_get(@keys);
}
sub _make_keys {
@@ -339,7 +339,7 @@ sub set {
}
$self->_make_alias_fields(\%pdata);
- $self->_do_set($self->{'state'}, $qf, \%pdata);
+ $self->_do_set($qf, \%pdata);
$self->_mark_dirty(1);
return 1;
}
@@ -409,7 +409,7 @@ sub _do_delete {
return 0 unless defined $lk;
if (@keys) {
- $hash = $self->_do_get($self->{'state'}, @keys);
+ $hash = $self->_do_get(@keys);
} else {
$hash = $self->{'state'};
}
@@ -529,7 +529,7 @@ sub _do_read_file {
$entry->{$fields->[$i]} = $values[$i]//'';
}
$self->_make_alias_fields($entry);
- $self->_do_set($root, $qf, $entry);
+ $self->_do_set($qf, $entry, $root);
}
close($fd);
return $root;
@@ -560,8 +560,8 @@ sub _make_alias_fields {
}
sub _do_get {
- my ($self, $root, @keys) = @_;
- my $cur = $root;
+ my ($self, @keys) = @_;
+ my $cur = $self->{'state'};
my (undef, undef, $qf) = $self->_type_to_fields;
my $max = scalar @$qf;
$max = scalar @keys if scalar @keys < $max;
@@ -574,9 +574,9 @@ sub _do_get {
}
sub _do_set {
- my ($self, $root, $qf, $entry) = @_;
+ my ($self, $qf, $entry, $root) = @_;
my $qfl = scalar @$qf - 1; # exclude the last element (see below)
- my $cur = $root;
+ my $cur = $root // $self->{'state'};
my $k;
# Find the hash where the entry should be stored
@@ -596,7 +596,7 @@ sub _do_set {
$k = $entry->{$qf->[$qfl]};
$cur->{$k} = $entry;
if (my $grouping = $self->{'grouping'}) {
- $grouping->_do_set($grouping->{'state'}, \@GROUP_QUERY, $entry);
+ $grouping->_do_set(\@GROUP_QUERY, $entry);
}
return 1;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: