[lintian] 06/08: L::C::B: Remove remaining initializations in objdump_info
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 470875fb03113466c671569eb61e70fc2b323550
Author: Niels Thykier <niels@thykier.net>
Date: Mon Jan 25 18:51:38 2016 +0000
L::C::B: Remove remaining initializations in objdump_info
With this, lintian is now down to 7.39MB memory on objdump_info on
linux-image-4.4.0-trunk-rt-686-pae/4.4-1~exp1/i386.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
checks/binaries.pm | 10 ++++++----
lib/Lintian/Collect/Binary.pm | 8 ++------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/checks/binaries.pm b/checks/binaries.pm
index 740b917..051d2ad 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -460,7 +460,7 @@ sub run {
if ($fname
=~ m,^usr/lib/debug/(?:lib\d*|s?bin|usr|opt|dev|emul|\.build-id)/,)
{
- if (scalar(@{ $objdump->{NEEDED} })) {
+ if (exists($objdump->{NEEDED})) {
tag 'debug-file-should-use-detached-symbols', $file;
}
tag 'debug-file-with-no-debug-symbols', $file
@@ -472,14 +472,14 @@ sub run {
# Detached debugging symbols directly in /usr/lib/debug.
if ($fname =~ m,^usr/lib/debug/[^/]+$,) {
- unless (scalar(@{ $objdump->{NEEDED} })
+ unless (exists($objdump->{NEEDED})
|| $fileinfo =~ m/statically linked/) {
tag 'debug-symbols-directly-in-usr-lib-debug', $file;
}
}
# statically linked?
- if (!scalar(@{ $objdump->{NEEDED} })) {
+ if (!exists($objdump->{NEEDED})) {
if ($fileinfo =~ m/shared object/o) {
# Some exceptions: kernel modules, syslinux modules, detached
# debugging information and the dynamic loader (which itself
@@ -520,9 +520,11 @@ sub run {
} else {
my $no_libc = 1;
my $is_shared = 0;
+ my @needed;
$needs_depends_line = 1;
$is_shared = 1 if index($fileinfo, 'shared object') != -1;
- for my $lib (@{$objdump->{NEEDED}}) {
+ @needed = @{$objdump->{NEEDED}} if exists($objdump->{NEEDED});
+ for my $lib (@needed) {
if ($lib =~ /^libc\.so\.(\d+.*)/) {
$needs_libc = "libc$1";
$needs_libc_file = $fname unless $needs_libc_file;
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 5117ced..cca6f34 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -369,11 +369,7 @@ sub objdump_info {
local $_;
my $fd = open_gz($objf);
foreach my $pg (parse_dpkg_control($fd)) {
- my %info = (
- 'PH' => {},
- 'SH' => {},
- 'NEEDED' => [],
- );
+ my %info;
if (lc($pg->{'broken'}//'no') eq 'yes') {
$info{'ERRORS'} = 1;
}
@@ -392,7 +388,7 @@ sub objdump_info {
foreach my $data (split m/\s*\n\s*/, $pg->{'section-headers'}//'') {
next unless $data;
my (undef, $section) = split m/\s++/, $data;
- $info{'SH'}->{$section}++;
+ $info{'SH'}{$section} = 1;
}
foreach my $data (split m/\s*\n\s*/, $pg->{'program-headers'}//'') {
next unless $data;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: