Просмотр исходного кода

Dpkg::Shlibs::*: style adjustments.

Use "my ($foo, $bar) = @_" rather than multiple shift()s.

Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Modestas Vainius лет назад: 16
Родитель
Сommit
210b816279

+ 5 - 6
scripts/Dpkg/Shlibs/Cppfilt.pm

@@ -41,10 +41,10 @@ sub get_cppfilt {
 	$filt = { from => undef, to => undef,
 	            last_symbol => "", last_result => "" };
 	$filt->{pid} = fork_and_exec(exec => [ 'c++filt',
-	                                         '--no-verbose',
-	                                         "--format=$type" ],
-	                              from_pipe => \$filt->{from},
-	                              to_pipe => \$filt->{to});
+	                                       '--no-verbose',
+	                                       "--format=$type" ],
+	                             from_pipe => \$filt->{from},
+	                             to_pipe => \$filt->{to});
 	internerr(_g("unable to execute c++filt")) unless defined $filt->{from};
 	$filt->{from}->autoflush(1);
 
@@ -58,8 +58,7 @@ sub get_cppfilt {
 # intact. If neither whole $symbol nor portion of it could be demangled, undef
 # is returned.
 sub cppfilt_demangle {
-    my $symbol = shift;
-    my $type = shift;
+    my ($symbol, $type) = @_;
 
     # Start or get c++filt 'object' for the requested type.
     my $filt = get_cppfilt($type);

+ 5 - 8
scripts/Dpkg/Shlibs/Symbol.pm

@@ -290,8 +290,7 @@ sub get_pattern {
 
 # Initialises this symbol as a pattern of the specified type.
 sub init_pattern {
-    my $self = shift;
-    my $type = shift;
+    my ($self, $type) = @_;
 
     $self->{pattern}{type} = $type;
     # To be filled with references to symbols matching this pattern.
@@ -346,9 +345,9 @@ sub create_pattern_match {
 # the current pattern ($self). Returns undef if the supplied raw name is not
 # transformable to alias.
 sub convert_to_alias {
-    my $self = shift;
-    my $rawname = shift;
-    my $type = shift || $self->get_alias_type();
+    my ($self, $rawname, $type) = @_;
+    $type = $self->get_alias_type() unless $type;
+
     if ($type) {
 	if ($type eq 'wildcard') {
 	    # In case of wildcard, alias is like "*@SYMBOL_VERSION". Extract
@@ -451,9 +450,7 @@ sub is_eligible_as_new {
 # Determine whether a supplied raw symbol name matches against current ($self)
 # symbol or pattern.
 sub matches_rawname {
-    my $self = shift;
-    my $rawname = shift;
-
+    my ($self, $rawname) = @_;
     my $target = $rawname;
     my $ok = 1;
     my $do_eq_match = 1;

+ 2 - 3
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -108,9 +108,8 @@ sub clear_except {
 
 # Create a symbol from the supplied string specification.
 sub create_symbol {
-    my $self = shift;
-    my $spec = shift;
-    my $symbol = shift || Dpkg::Shlibs::Symbol->new();
+    my ($self, $spec, $symbol) = @_;
+    $symbol = Dpkg::Shlibs::Symbol->new() unless defined $symbol;
 
     if ($symbol->parse($spec)) {
 	$symbol->initialize(arch => $self->{arch});

+ 2 - 3
scripts/t/200_Dpkg_Shlibs.t

@@ -159,11 +159,10 @@ use File::Temp;
 use File::Basename qw(basename);
 
 sub save_load_test {
-    my $symfile = shift;
-    my $comment = shift;
+    my ($symfile, $comment, @opts) = @_;
 
     my $save_file = new File::Temp;
-    $symfile->save($save_file->filename, @_);
+    $symfile->save($save_file->filename, @opts);
     my $dup = new Dpkg::Shlibs::SymbolFile(file => $save_file->filename);
     # Force sync of non-stored attributes
     $dup->{file} = $symfile->{file};