Chia-liang Kao wrote:
> On Sat, Aug 13, 2005 at 08:25:01AM -0400, David James wrote:
>
>>>if (length($buf)) {
>>> return $buf;
>>>} else {
>>> return;
>>>}
>>
>>Good advice, Blair! I think users will benefit from this attention to
>>detail -- I'd recommend this for the 1.3.x line. (I'm not sure what
>>the API compatibility rules are for the Perl bindings, but this change
>>seems like it would be compatible with what users already expect from
>>the Perl bindings API.)
>
>
> I don't think we need to maintain bugward compatibility.
> Blair, would you like to commit this yourself and perhaps
> nominate for 1.2.x along with related changes?
Here's a patch fixing all the return undef's I could find. I don't have the
time to put together a new build to test this, so I'll leave it to you to double
check and do the commit.
BTW, the Perl files have a mixture of tabs and spaces, so the indentation looks
odd in my editor (jove). Our hacking document has a no tab convention, so it
would be good to take a couple of minutes and clean it up.
http://subversion.tigris.org/hacking.html (see Other Conventions)
Regards,
Blair
Index: subversion/bindings/swig/perl/native/Core.pm
===================================================================
--- subversion/bindings/swig/perl/native/Core.pm (revision 15719)
+++ subversion/bindings/swig/perl/native/Core.pm (working copy)
@@ -162,7 +162,7 @@
my $self = shift;
my $buf;
return $buf if $self->read($buf, 1);
- return undef;
+ return;
}
sub print
@@ -201,7 +201,7 @@
my $self = shift;
*$self->{pool} ||= SVN::Core::pool_create (undef);
my ($buf, $eof) = *$self->{svn_stream}->readline ($/, *$self->{pool});
- return undef if $eof && !length($buf);
+ return if $eof && !length($buf);
return $eof ? $buf : $buf.$/;
}
@@ -227,7 +227,11 @@
}
elsif (ref $/) {
my $buf = *$self->{svn_stream}->read (${$/});
- return length($buf) ? $buf : undef;
+ if (length($buf)) {
+ return $buf;
+ } else {
+ return;
+ }
}
return wantarray ? $self->getlines : $self->getline;
}
@@ -269,7 +273,7 @@
*close = \&CLOSE;
sub FILENO {
- return undef; # XXX perlfunc says this means the file is closed
+ return; # XXX perlfunc says this means the file is closed
}
sub DESTROY {
@@ -569,17 +573,17 @@
=cut
sub expanded_message {
- my $svn_error = shift;
+ my $svn_error = shift;
unless (is_error($svn_error)) {
- return undef;
- }
+ return;
+ }
- my $error_message = $svn_error->strerror();
- while ($svn_error) {
- $error_message .= ': ' . $svn_error->message();
- $svn_error = $svn_error->child();
- }
- return $error_message;
+ my $error_message = $svn_error->strerror();
+ while ($svn_error) {
+ $error_message .= ': ' . $svn_error->message();
+ $svn_error = $svn_error->child();
+ }
+ return $error_message;
}
Index: subversion/bindings/swig/perl/native/Delta.pm
===================================================================
--- subversion/bindings/swig/perl/native/Delta.pm (revision 15719)
+++ subversion/bindings/swig/perl/native/Delta.pm (working copy)
@@ -161,7 +161,11 @@
die $@ if $@;
- return @ret ? $#ret == 0 ? $ret[0] : [@ret] : undef;
+ if (@ret) {
+ return $#ret == 0 ? $ret[0] : [@ret];
+ } else {
+ return;
+ }
}
=head1 BUGS
Index: subversion/bindings/swig/perl/native/Ra.pm
===================================================================
--- subversion/bindings/swig/perl/native/Ra.pm (revision 15719)
+++ subversion/bindings/swig/perl/native/Ra.pm (working copy)
@@ -188,7 +188,7 @@
}
sub get_wc_prop {
- return undef;
+ return;
}
=head1 AUTHORS
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Aug 14 22:45:06 2005