]> git.ipfire.org Git - thirdparty/git.git/commit - git-send-email.perl
send-email: use "return;" not "return undef;" on error codepaths
authorRamkumar Ramachandra <artagnon@gmail.com>
Mon, 1 Apr 2013 01:40:40 +0000 (18:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2013 04:30:09 +0000 (21:30 -0700)
commit622bc9309155b05af1a0d85bfb643bf6280eba35
treeb774d7625db651eb891026c8c385dc86171bfabd
parent5e950c2199448d44388f7ca25c837fe7650da93c
send-email: use "return;" not "return undef;" on error codepaths

All the callers of "ask", "extract_valid_address", and "validate_patch"
subroutines assign the return values from them to a single scalar:

$var = subr(...);

and "return undef;" in these subroutine can safely be turned into a
simpler "return;".  Doing so will also future-proof a new caller that
mistakenly does this:

    @foo = ask(...);
    if (@foo) { ... we got an answer ... } else { ... we did not ... }

Note that we leave "return undef;" in validate_address on purpose,
even though Perlcritic may complain.  The primary "return" site of
the function returns whatever is in the scalar variable $address, so
it is pointless to change only the other "return undef;" to "return".
The caller must be prepared to see an array with a single undef as
the return value from this subroutine anyway.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl