diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2006-11-17 15:34:16 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2006-11-17 15:34:16 +0000 |
commit | 2f7c716c186d427b593b0f12ecc9a5b8f35bb1fe (patch) | |
tree | f7e5efb23a54ef14f47c5355605b80bfe2dd6237 | |
parent | 7dce63f735f77b1db8d66d52d33ae5f63544523a (diff) |
don't return undef, use plain return.
(return undef is only false in a scalar context)
found my perlcritic, one of the few issues I agree with...
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Interactive.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocation.pm | 18 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 24 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Replace.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 30 |
10 files changed, 62 insertions, 62 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index cbae18cfc81..b89858e3dfb 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.4 2005/10/10 11:24:34 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.5 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2005 Marc Espie <espie@openbsd.org> # @@ -124,7 +124,7 @@ sub check_lib_spec return $candidate; } } - return undef; + return; } sub find_old_lib @@ -139,7 +139,7 @@ sub find_old_lib return "$try($lib)"; } } - return undef; + return; } sub lookup_library diff --git a/usr.sbin/pkg_add/OpenBSD/Interactive.pm b/usr.sbin/pkg_add/OpenBSD/Interactive.pm index a57e8f86b40..efc6c72ea0d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Interactive.pm +++ b/usr.sbin/pkg_add/OpenBSD/Interactive.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Interactive.pm,v 1.4 2006/11/17 09:58:20 bernd Exp $ +# $OpenBSD: Interactive.pm,v 1.5 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2005 Marc Espie <espie@openbsd.org> # @@ -114,7 +114,7 @@ sub choose1 } } } - return undef; + return; } 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm index 2e3bb2883a8..c644e3e6fa2 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageLocation.pm,v 1.4 2006/03/13 16:08:12 espie Exp $ +# $OpenBSD: PackageLocation.pm,v 1.5 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -43,7 +43,7 @@ sub openArchive $self->{repository}->parse_problems($self->{errors}) if defined $self->{errors}; undef $self->{errors}; - return undef; + return; } require OpenBSD::Ustar; @@ -119,7 +119,7 @@ sub grabPlist $pkg->close_now(); return $plist; } else { - return undef; + return; } } @@ -128,7 +128,7 @@ sub openPackage my $self = shift; my $arch = $self->{arch}; if (!$self->openArchive()) { - return undef; + return; } $self->scanPackage(); @@ -162,7 +162,7 @@ sub openPackage # hopeless $self->close_with_client_error(); $self->wipe_info(); - return undef; + return; } sub wipe_info @@ -196,7 +196,7 @@ sub plist # hopeless $self->close_with_client_error(); - return undef; + return; } sub close @@ -242,7 +242,7 @@ sub reopen { my $self = shift; if (!$self->openArchive()) { - return undef; + return; } while (my $e = $self->{_archive}->next()) { if ($e->{name} eq $self->{_current}->{name}) { @@ -250,7 +250,7 @@ sub reopen return $self; } } - return undef; + return; } # proxy for archive operations @@ -270,7 +270,7 @@ sub intNext if (!defined $self->{fh}) { if (!$self->reopen()) { - return undef; + return; } } if (!$self->{_unput}) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index f94d7a86686..5e64bb27796 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.13 2006/09/16 15:04:23 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.14 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -142,13 +142,13 @@ sub open { my ($self, $object) = @_; - return undef unless $self->may_exist($object->{name}); + return unless $self->may_exist($object->{name}); # kill old files if too many my $already = $self->make_room(); my $fh = $self->open_pipe($object); if (!defined $fh) { - return undef; + return; } $object->{fh} = $fh; if (defined $already) { @@ -481,7 +481,7 @@ sub _list my ($self, $cmd) = @_; my $l =[]; local $_; - open(my $fh, '-|', "$cmd") or return undef; + open(my $fh, '-|', "$cmd") or return; while(<$fh>) { chomp; next if m/^d.*\s+\S/; @@ -557,7 +557,7 @@ sub list my $fullname = $self->{baseurl}; my $l = $self->{list} = []; local $_; - open(my $fh, '-|', "ftp -o - $fullname 2>$error") or return undef; + open(my $fh, '-|', "ftp -o - $fullname 2>$error") or return; # XXX assumes a pkg HREF won't cross a line. Is this the case ? while(<$fh>) { chomp; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm index 0b9734ef3d8..eb821645d4a 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepositoryList.pm,v 1.2 2006/03/08 12:10:47 espie Exp $ +# $OpenBSD: PackageRepositoryList.pm,v 1.3 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -57,7 +57,7 @@ sub find } return $pkg if defined $pkg; } - return undef; + return; } sub grabPlist @@ -82,7 +82,7 @@ sub grabPlist } return $plist if defined $plist; } - return undef; + return; } sub available diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 4d857b08c26..ec4bf2c66e9 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.83 2006/03/19 12:01:13 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.84 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -443,7 +443,7 @@ sub add { my ($class, $plist, @args) = @_; $plist->{state}->{ignore} = 1; - return undef; + return; } # Comment is very special @@ -461,12 +461,12 @@ sub add return OpenBSD::PackingElement::CVSTag->add($plist, @args); } elsif ($args[0] =~ m/^MD5:\s*/) { $plist->{state}->{lastfile}->add_md5(pack('H*', $')); - return undef; + return; } elsif ($args[0] =~ m/^subdir\=(.*?)\s+cdrom\=(.*?)\s+ftp\=(.*?)\s*$/) { return OpenBSD::PackingElement::ExtraInfo->add($plist, $1, $2, $3); } elsif ($args[0] eq 'no checksum') { $plist->{state}->{nochecksum} = 1; - return undef; + return; } else { return $class->SUPER::add($plist, @args); } @@ -489,7 +489,7 @@ sub add my ($class, $plist, @args) = @_; $plist->{state}->{lastfile}->add_md5(pack('H*', $')); - return undef; + return; } package OpenBSD::PackingElement::symlink; @@ -502,7 +502,7 @@ sub add my ($class, $plist, @args) = @_; $plist->{state}->{lastfile}->make_symlink(@args); - return undef; + return; } package OpenBSD::PackingElement::hardlink; @@ -515,7 +515,7 @@ sub add my ($class, $plist, @args) = @_; $plist->{state}->{lastfile}->make_hardlink(@args); - return undef; + return; } package OpenBSD::PackingElement::temp; @@ -527,7 +527,7 @@ sub add { my ($class, $plist, @args) = @_; $plist->{state}->{lastfile}->set_tempname(@args); - return undef; + return; } package OpenBSD::PackingElement::size; @@ -540,7 +540,7 @@ sub add my ($class, $plist, @args) = @_; $plist->{state}->{lastfile}->add_size($args[0]); - return undef; + return; } package OpenBSD::PackingElement::Option; @@ -825,7 +825,7 @@ sub check my $self = shift; my ($name, $passwd, $uid, $gid, $quota, $class, $gcos, $dir, $shell, $expire) = getpwnam($self->{name}); - return undef unless defined $name; + return unless defined $name; if ($self->{uid} =~ m/^\!/) { return 0 unless $uid == $'; } @@ -880,7 +880,7 @@ sub check { my $self = shift; my ($name, $passwd, $gid, $members) = getgrnam($self->{name}); - return undef unless defined $name; + return unless defined $name; if ($self->{gid} =~ m/^\!/) { return 0 unless $gid == $'; } @@ -1366,7 +1366,7 @@ sub check } return 1 if $ok eq $arch; } - return undef; + return; } 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 119ae002f0a..37c1072b9cf 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.50 2005/09/19 09:51:01 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.51 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -259,7 +259,7 @@ sub write sub fromfile { my ($a, $fname, $code) = @_; - open(my $fh, '<', $fname) or return undef; + open(my $fh, '<', $fname) or return; my $plist = $a->read($fh, $code); close($fh); return $plist; @@ -268,9 +268,9 @@ sub fromfile sub tofile { my ($self, $fname) = @_; - open(my $fh, '>', $fname) or return undef; + open(my $fh, '>', $fname) or return; $self->write($fh); - close($fh) or return undef; + close($fh) or return; return 1; } diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index 6078dbaf584..25b6bf3a32d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Replace.pm +++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Replace.pm,v 1.2 2006/04/22 10:31:44 bernd Exp $ +# $OpenBSD: Replace.pm,v 1.3 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -119,34 +119,34 @@ sub update_issue($$) package OpenBSD::PackingElement::FINSTALL; sub update_issue($$) { - return undef if !$_[1]; + return if !$_[1]; return $_[0]->SUPER::update_issue($_[1]); } package OpenBSD::PackingElement::FDEINSTALL; sub update_issue($$) { - return undef if $_[1]; + return if $_[1]; return $_[0]->SUPER::update_issue($_[1]); } package OpenBSD::PackingElement::Exec; sub update_issue($$) { - return undef if !$_[1]; + return if !$_[1]; return '@exec '.$_[0]->{expanded}; } package OpenBSD::PackingElement::Unexec; sub update_issue($$) { - return undef if $_[1]; + return if $_[1]; my $self = $_[0]; # those are deemed innocuous if ($self->{expanded} =~ m|^/sbin/ldconfig\s+\-R\b| or $self->{expanded} =~ m|^install-info\s+\-\-delete\b|) { - return undef; + return; } else { return '@unexec '.$self->{expanded}; } diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index b8874c639a0..32f39253bda 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.42 2006/08/05 08:21:55 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.43 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -100,7 +100,7 @@ sub next $self->skip(); my $header; my $n = read $self->{fh}, $header, 512; - return undef if $n == 0; + return if $n == 0; die "Error while reading header" unless defined $n and $n == 512; if ($header eq "\0"x512) { @@ -541,7 +541,7 @@ sub new my ($class, $fname) = @_; open (my $out, '>', $fname); if (!defined $out) { - return undef; + return; } my $bs = (stat $out)[11]; my $zeroes; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index d9f41e5fb27..63b9806d250 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.219 2006/10/17 21:47:22 espie Exp $ +# $OpenBSD: pkg_add,v 1.220 2006/11/17 15:34:15 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -78,7 +78,7 @@ sub can_install($$$) print "Not reinstalling $pkgname\n" if $state->{verbose}; OpenBSD::SharedLibs::add_package_libs($plist->pkgname()); $state->{installed}->{$pkgname} = 1; - return undef; + return; } if ($state->{forced}->{conflicts}) { print "Forcing install of $pkgname in the presence of conflicts (",join(',', @conflicts, @libs), ")\n"; @@ -86,13 +86,13 @@ sub can_install($$$) } print "Can't install $pkgname because of conflicts (",join(',', @conflicts, @libs), ")\n"; $errors++; - return undef; + return; } if (@conflicts > 5) { print "Can't install $pkgname because of conflicts (",join(',', @conflicts, @libs), ")\n"; $errors++; - return undef; + return; } require OpenBSD::Replace; @@ -103,26 +103,26 @@ sub can_install($$$) print "Not reinstalling $pkgname\n" if $state->{verbose}; OpenBSD::SharedLibs::add_package_libs($plist->pkgname()); $state->{installed}->{$pkgname} = 1; - return undef; + return; } } if (!OpenBSD::Replace::is_safe($plist, $state)) { print "Can't safely update to $pkgname (use -F update to force it)\n"; $errors++; - return undef; + return; } if (!OpenBSD::Replace::figure_out_libs($plist, $state, @libs)) { print "Can't update to $pkgname because of collision with old libs\n"; $errors++; - return undef; + return; } for my $toreplace (@conflicts) { if (defined $state->{installed}->{$toreplace}) { Warn "Cannot replace $toreplace with $pkgname: just got installed\n"; $errors++; - return undef; + return; } my $rplist = OpenBSD::Replace::can_do($toreplace, $pkgname, @@ -130,7 +130,7 @@ sub can_install($$$) if (!$rplist) { print "Can't update $toreplace into $pkgname\n"; $errors++; - return undef; + return; } $rplist->{dir} = installed_info($toreplace); push(@{$plist->{replacing}}, $rplist); @@ -154,21 +154,21 @@ sub pre_add($$) if (!$state->{forced}->{kitchensink}) { $errors++; } - return undef; + return; } if ($handle->{finished}) { - return undef; + return; } my $plist = $handle->{plist} = $handle->plist(); unless (defined $plist) { print "Can't find CONTENTS from $pkg\n"; $errors++; - return undef; + return; } if ($plist->pkgbase() ne $state->{localbase}) { print "Localbase mismatch: package has: ", $plist->pkgbase(), " , user wants: ", $state->{localbase}, "\n"; $errors++; - return undef; + return; } my $pkgname = $handle->{pkgname} = $plist->pkgname(); if ($pkg ne '-') { @@ -176,7 +176,7 @@ sub pre_add($$) OpenBSD::PackageName::url2pkgname($pkg) ne $pkgname) { print "Package name is not consistent ???\n"; $errors++; - return undef; + return; } } if ($state->{verbose}) { @@ -195,7 +195,7 @@ sub pre_add($$) if ($state->{forced}->{kitchensink}) { $errors = 0; } - return undef; + return; } } |