Przeglądaj źródła

Use || to fallback to a default value instead of using !defined()

Guillem Jover 18 lat temu
rodzic
commit
8406f05986
2 zmienionych plików z 7 dodań i 3 usunięć
  1. 6 0
      ChangeLog
  2. 1 3
      scripts/dpkg-gencontrol.pl

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2007-12-12  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-gencontrol.pl (spfileslistvalue): Use || to fallback to
+	a default value instead of using a temporary variable and checking if
+	it's not defined.
+
 2007-12-12  Guillem Jover  <guillem@debian.org>
 
 	* scripts/dpkg-genchanges.pl: Use ||= instead of checking if the

+ 1 - 3
scripts/dpkg-gencontrol.pl

@@ -85,9 +85,7 @@ Options:
 
 sub spfileslistvalue($)
 {
-    my $r = $f{$_[0]};
-    $r = '-' if !defined($r);
-    return $r;
+    return $f{$_[0]} || '-';
 }