Skip to content

Commit

Permalink
Item1518: "return" statement with explicit "undef". See page 199 of PBP.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@3945 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed May 20, 2009
1 parent 7970b4b commit b81b96e
Show file tree
Hide file tree
Showing 49 changed files with 108 additions and 108 deletions.
4 changes: 2 additions & 2 deletions MailerContrib/lib/Foswiki/Contrib/MailerContrib/Subscriber.pm
Expand Up @@ -235,7 +235,7 @@ sub isSubscribedTo {
}
}

return undef;
return;
}

=pod
Expand All @@ -256,7 +256,7 @@ sub isUnsubscribedFrom {
}
}

return undef;
return;
}

=pod
Expand Down
2 changes: 1 addition & 1 deletion PreferencesPlugin/lib/Foswiki/Plugins/PreferencesPlugin.pm
Expand Up @@ -153,7 +153,7 @@ sub _getField {
return $f;
}
}
return undef;
return;
}

# Generate a field suitable for editing this type. Use of the core
Expand Down
20 changes: 10 additions & 10 deletions WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin.pm
Expand Up @@ -449,7 +449,7 @@ sub postConvertURL {
sub _convertImage {
my ( $src, $opts ) = @_;

return undef unless $src;
return unless $src;

local $recursionBlock = 1; # block calls to beforeCommonTagshandler

Expand Down Expand Up @@ -734,7 +734,7 @@ sub _restTML2HTML {

returnRESTResult( $response, 200, $html );

return undef; # to prevent further processing
return; # to prevent further processing
}

# Rest handler for use from Javascript
Expand Down Expand Up @@ -762,7 +762,7 @@ sub _restHTML2TML {
);

returnRESTResult( $response, 200, $tml );
return undef; # to prevent further processing
return; # to prevent further processing
}

# SMELL: foswiki supports proper REST usage of the upload script,
Expand All @@ -773,7 +773,7 @@ sub _restUpload {
# Item1458 ignore uploads not using POST
if ($query && $query->method() && uc($query->method()) ne 'POST') {
returnRESTResult($response, 405, "Method not Allowed");
return undef;
return;
}
my ( $web, $topic ) =
Foswiki::Func::normalizeWebTopicName( undef, $query->param('topic') );
Expand All @@ -783,7 +783,7 @@ sub _restUpload {
\&Foswiki::Sandbox::validateTopicName );
unless ( defined $web && defined $topic ) {
returnRESTResult( $response, 401, "Access denied" );
return undef; # to prevent further processing
return; # to prevent further processing
}
my $hideFile = $query->param('hidefile') || '';
my $fileComment = $query->param('filecomment') || '';
Expand All @@ -809,7 +809,7 @@ sub _restUpload {
)
{
returnRESTResult( $response, 401, "Access denied" );
return undef; # to prevent further processing
return; # to prevent further processing
}

my ( $fileSize, $fileDate, $tmpFileName );
Expand All @@ -832,15 +832,15 @@ sub _restUpload {

unless ( $fileSize && $fileName ) {
returnRESTResult( $response, 500, "Zero-sized file upload" );
return undef; # to prevent further processing
return; # to prevent further processing
}

my $maxSize = Foswiki::Func::getPreferencesValue('ATTACHFILESIZELIMIT');
$maxSize = 0 unless ( $maxSize =~ /([0-9]+)/o );

if ( $maxSize && $fileSize > $maxSize * 1024 ) {
returnRESTResult( $response, 500, "OVERSIZED UPLOAD" );
return undef; # to prevent further processing
return; # to prevent further processing
}
}

Expand All @@ -866,7 +866,7 @@ sub _restUpload {

if ($error) {
returnRESTResult( $response, 500, $error );
return undef; # to prevent further processing
return; # to prevent further processing
}

# Otherwise allow the rest dispatcher to write a 200
Expand Down Expand Up @@ -904,7 +904,7 @@ sub _restAttachments {
)
{
returnRESTResult( $response, 401, "Access denied" );
return undef; # to prevent further processing
return; # to prevent further processing
}

# Create a JSON list of attachment data, sorted by name
Expand Down
Expand Up @@ -1022,12 +1022,12 @@ sub isBlockNode {
sub previousLeaf {
my $node = shift;
if ( !$node ) {
return undef;
return;
}
do {
while ( !$node->{prev} ) {
if ( !$node->{parent} ) {
return undef; # can't go any further back
return; # can't go any further back
}
$node = $node->{parent};
}
Expand All @@ -1052,7 +1052,7 @@ sub _checkBeforeEmphasis {
sub nextLeaf {
my $node = shift;
if ( !$node ) {
return undef;
return;
}
do {
while ( !$node->{next} ) {
Expand Down
2 changes: 1 addition & 1 deletion core/bin/configure
Expand Up @@ -277,7 +277,7 @@ sub findFileOnPath {
return "$dir/$file";
}
}
return undef;
return;
}

###########################################################
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Assert.pm
Expand Up @@ -63,7 +63,7 @@ sub ASSERT ($;$) {
$msg .= " failed!\n";
Carp::confess($msg);
}
return undef;
return;
}

# Test if a value is untainted
Expand Down
2 changes: 1 addition & 1 deletion core/lib/CPAN/lib/Algorithm/Diff.pm
Expand Up @@ -88,7 +88,7 @@ sub _replaceNextLargerWith

if ( $aValue == $found )
{
return undef;
return;
}
elsif ( $aValue > $found )
{
Expand Down
4 changes: 2 additions & 2 deletions core/lib/CPAN/lib/CGI/Session.pm
Expand Up @@ -288,7 +288,7 @@ sub param {
if ($name =~ m/^_SESSION_/) {

carp "param(): attempt to write to private parameter";
return undef;
return;
}
$self->_set_status( STATUS_MODIFIED );
return $self->{_DATA}->{ $name } = $value;
Expand Down Expand Up @@ -699,7 +699,7 @@ sub load {
$self->_load_pluggables();

# Did load_pluggable fail? If so, return undef, just like $class->set_error() would
return undef if $class->errstr;
return if $class->errstr;

if (not defined $self->{_CLAIMED_ID}) {
my $query = $self->query();
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Foswiki.pm
Expand Up @@ -508,7 +508,7 @@ sub UTF82SiteCharSet {
return $text unless ( defined $Foswiki::cfg{Site}{CharSet} );

# Detect character encoding of the full topic name from URL
return undef if ( $text =~ $regex{validAsciiStringRegex} );
return if ( $text =~ $regex{validAsciiStringRegex} );

# SMELL: all this regex stuff should go away.
# If not UTF-8 - assume in site character set, no conversion required
Expand All @@ -523,7 +523,7 @@ sub UTF82SiteCharSet {
else {

#SMELL: this seg faults on OSX leopard. (and possibly others)
return undef unless ( $text =~ $regex{validUtf8StringRegex} );
return unless ( $text =~ $regex{validUtf8StringRegex} );
}

# If site charset is already UTF-8, there is no need to convert anything:
Expand Down Expand Up @@ -2687,7 +2687,7 @@ sub _expandMacroOnTopicCreation {
# This is what we want to make sure new user templates are populated
# correctly, but you need to think about this if you extend the set of
# tags expanded here.
return undef
return
unless $_[0] =~
/^(URLPARAM|DATE|(SERVER|GM)TIME|(USER|WIKI)NAME|WIKIUSERNAME|USERINFO)$/;

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Checkers/BasicSanity.pm
Expand Up @@ -141,7 +141,7 @@ HERE
sub _copy {
my $n = shift;

return undef unless defined($n);
return unless defined($n);

if ( UNIVERSAL::isa( $n, 'ARRAY' ) ) {
my @new;
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Configure/FoswikiCfg.pm
Expand Up @@ -122,7 +122,7 @@ sub _loadSpecsFrom {
return $this;
}

sub getValueObject { return undef; }
sub getValueObject { return; }
}

# Process the config array and add section objects
Expand Down Expand Up @@ -179,7 +179,7 @@ sub _getValueObject {
my $i = $item->getValueObject($keys);
return $i if $i;
}
return undef;
return;
}

# Parse the config declaration file and return a root node for the
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Configure/Item.pm
Expand Up @@ -73,11 +73,11 @@ sub inc {
}

sub getSectionObject {
return undef;
return;
}

sub getValueObject {
return undef;
return;
}

1;
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Configure/Section.pm
Expand Up @@ -78,7 +78,7 @@ sub getSectionObject {
my $cvo = $child->getSectionObject( $head, $depth );
return $cvo if $cvo;
}
return undef;
return;
}

# Get the value object associated with the given keys
Expand All @@ -88,7 +88,7 @@ sub getValueObject {
my $cvo = $child->getValueObject($keys);
return $cvo if $cvo;
}
return undef;
return;
}

# See if this section is changed from the default values. Should
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Configure/UI.pm
Expand Up @@ -57,7 +57,7 @@ sub getRepository {
foreach my $place ( @{ $this->{repositories} } ) {
return $place if $place->{name} eq $reponame;
}
return undef;
return;
}

# Static UI factory
Expand All @@ -69,7 +69,7 @@ sub loadUI {

eval "use $id; \$ui = new $id(\$item);";

return undef if ( !$ui && $@ );
return if ( !$ui && $@ );

return $ui;
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm
Expand Up @@ -260,7 +260,7 @@ sub _getInstalledVersion {
my ( $this, $module ) = @_;
my $lib;

return undef unless $module;
return unless $module;

if ( $module =~ /Plugin$/ ) {
$lib = 'Plugins';
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Value.pm
Expand Up @@ -63,7 +63,7 @@ sub getValueObject {
my ( $this, $keys ) = @_;

return $this if ( $this->{keys} && $keys eq $this->{keys} );
return undef;
return;
}

# See if this value is changed from the default. The comparison
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Foswiki/Form.pm
Expand Up @@ -77,15 +77,15 @@ sub new {
Foswiki::Sandbox::untaint( $form, \&Foswiki::Sandbox::validateTopicName );

unless ( $web && $form ) {
return undef;
return;
}

my $this = $session->{forms}->{"$web.$form"};
unless ($this) {

# Got to have either a def or a topic
unless ( $def || $session->topicExists( $web, $form ) ) {
return undef;
return;
}

$this = $class->SUPER::new( $session, $web, $form );
Expand Down Expand Up @@ -516,7 +516,7 @@ sub getField {
foreach my $fieldDef ( @{ $this->{fields} } ) {
return $fieldDef if ( $fieldDef->{name} && $fieldDef->{name} eq $name );
}
return undef;
return;
}

=begin TML
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Foswiki/Func.pm
Expand Up @@ -663,10 +663,10 @@ sub wikiToUserName {
my $cUID = getCanonicalUserID($wiki);
if ($cUID) {
my $login = $Foswiki::Plugins::SESSION->{users}->getLoginName($cUID);
return undef if !$login || $login eq 'unknown';
return if !$login || $login eq 'unknown';
return $login;
}
return undef;
return;
}

=begin TML
Expand Down Expand Up @@ -942,7 +942,7 @@ Use it as follows:
sub eachGroupMember {
my $user = shift;
my $session = $Foswiki::Plugins::SESSION;
return undef
return
unless $Foswiki::Plugins::SESSION->{users}->isGroup($user);
my $it = $Foswiki::Plugins::SESSION->{users}->eachGroupMember($user);
$it->{process} = sub {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/I18N.pm
Expand Up @@ -382,7 +382,7 @@ sub fromSiteCharSet {
. $Foswiki::cfg{Site}{CharSet}
. '" not supported, or name not recognised - check '
. '"perldoc Encode::Supported"' );
return undef;
return;
}
else {
my $octets =
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/I18N/Extract.pm
Expand Up @@ -42,7 +42,7 @@ sub new {

if (defined $initError) {
$session->logger->log( 'warning', $initError ) if $session;
return undef;
return;
}

my $self = new Locale::Maketext::Extract;
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Iterator/FilterIterator.pm
Expand Up @@ -57,7 +57,7 @@ sub hasNext {
# See Foswiki::Iterator for a description of the general iterator contract
sub next {
my $this = shift;
return undef unless $this->hasNext();
return unless $this->hasNext();
$this->{pending} = 0;
return $this->{next};
}
Expand Down

0 comments on commit b81b96e

Please sign in to comment.