From: Guillem Jover Date: Wed, 12 Dec 2007 07:34:18 +0000 (+0200) Subject: Use ||= instead of checking if the variables are not defined X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd97956b9c8b705ad224e830d65c0c81e8e64370;p=dpkg Use ||= instead of checking if the variables are not defined --- diff --git a/ChangeLog b/ChangeLog index 93b1463f..1d1e5195 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-12 Guillem Jover + + * scripts/dpkg-genchanges.pl: Use ||= instead of checking if the + variables are not defined. + * scripts/dpkg-gencontrol.pl: Likewise. + * scripts/update-alternatives.pl (fill_missing_slavepaths): Likewise. + 2007-12-11 Raphael Hertzog * scripts/Dpkg/Deps.pm: Add a compare function that compares diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl index 9ff8a8d6..81d39932 100755 --- a/scripts/dpkg-genchanges.pl +++ b/scripts/dpkg-genchanges.pl @@ -333,7 +333,7 @@ for my $p (keys %p2f) { foreach my $f (@f) { my $sec = $f2seccf{$f}; - $sec = $sourcedefault{'Section'} if !defined($sec); + $sec ||= $sourcedefault{'Section'}; if (!defined($sec)) { $sec = '-'; warning(_g("missing Section for binary package %s; using '-'"), $p); @@ -342,7 +342,7 @@ for my $p (keys %p2f) { "control file but %s in files list"), $p, $sec, $f2sec{$f}); my $pri = $f2pricf{$f}; - $pri = $sourcedefault{'Priority'} if !defined($pri); + $pri ||= $sourcedefault{'Priority'}; if (!defined($pri)) { $pri = '-'; warning(_g("missing Priority for binary package %s; using '-'"), $p); diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index 6dd76aca..b70d63bc 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/scripts/dpkg-gencontrol.pl @@ -163,7 +163,7 @@ for $_ (keys %fi) { $f{$_} = $v; } elsif (m/^(Section|Priority|Homepage)$/) { # Binary package stanzas can override these fields - $f{$_} = $v if !defined($f{$_}); + $f{$_} ||= $v; } elsif (m/^Source$/) { setsourcepackage($v); } diff --git a/scripts/update-alternatives.pl b/scripts/update-alternatives.pl index 12eb2ec1..8e7fb671 100755 --- a/scripts/update-alternatives.pl +++ b/scripts/update-alternatives.pl @@ -170,7 +170,7 @@ sub fill_missing_slavepaths() { for (my $j = 0; $j <= $#slavenames; $j++) { for (my $i = 0; $i <= $#versions; $i++) { - $slavepath{$i,$j} = '' if !defined $slavepath{$i,$j}; + $slavepath{$i,$j} ||= ''; } } }