summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Shlibs
diff options
context:
space:
mode:
authorModestas Vainius <modax@debian.org>2010-01-05 02:03:28 +0200
committerRaphaël Hertzog <hertzog@debian.org>2010-01-11 19:09:57 +0100
commit2425566eb66ad35a24e7cbf8515a3a2e2fad2357 (patch)
treef40ef112c37983923615b2dd8f89da15cfae1f93 /scripts/Dpkg/Shlibs
parent8ad712068d4b33339fc9e88c0e05f75c3c6bc72d (diff)
downloaddpkg-2425566eb66ad35a24e7cbf8515a3a2e2fad2357.tar.gz
Dpkg::Shlibs::SymbolFile::get_new_symbols(): simplify and shorten code
Reduce the code in get_new_symbols() by enumerating symbols, rather than their names. Also split off some code to Symbol::is_eligible_as_new() function. Patch is supposed to result in no behavioral changes. Signed-off-by: Modestas Vainius <modax@debian.org> Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Diffstat (limited to 'scripts/Dpkg/Shlibs')
-rw-r--r--scripts/Dpkg/Shlibs/Symbol.pm9
-rw-r--r--scripts/Dpkg/Shlibs/SymbolFile.pm15
2 files changed, 16 insertions, 8 deletions
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index d1920e14f..88650b351 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -436,4 +436,13 @@ sub mark_not_found_in_library {
}
}
+# Quickly checks if the symbol (or pattern) can be considered as new due to its
+# status or current environment settings.
+sub is_eligible_as_new {
+ my ($self, $arch) = @_;
+ return ! $self->{deprecated} &&
+ ! $self->is_optional() &&
+ $self->arch_is_concerned($arch);
+}
+
1;
diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm
index 433e5d127..65f85a32e 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -439,16 +439,15 @@ sub get_new_symbols {
my $mysyms = $self->{objects}{$soname}{syms};
next if not exists $ref->{objects}{$soname};
my $refsyms = $ref->{objects}{$soname}{syms};
- foreach my $sym (grep { not $mysyms->{$_}{deprecated} and
- not $mysyms->{$_}->is_optional() and
- $mysyms->{$_}->arch_is_concerned($self->{arch})
- } keys %{$mysyms})
+ foreach my $sym (grep { $_->is_eligible_as_new($self->{arch}) }
+ values %$mysyms)
{
- if ((not exists $refsyms->{$sym}) or
- $refsyms->{$sym}{deprecated} or
- not $refsyms->{$sym}->arch_is_concerned($self->{arch}) )
+ my $refsym = $refsyms->{$sym->get_symbolname()};
+ if ((not defined $refsym) or
+ $refsym->{deprecated} or
+ not $refsym->arch_is_concerned($self->{arch}) )
{
- push @res, $mysyms->{$sym}->sclone(soname => $soname);
+ push @res, $sym->sclone(soname => $soname);
}
}
}