Hello,
if I can help, I could look at this also. Some "cosmetics" (indentions, placing { on the line of 'if', ... ) could make the code more readable. These produce some greater patches without a gain in correctness but in maintainability.
Regards, Bernhard Bitsch
Gesendet: Mittwoch, 14. Februar 2018 um 23:12 Uhr Von: "Michael Tremer" michael.tremer@ipfire.org An: "Bernhard Held" berny156@gmx.de, development@lists.ipfire.org Betreff: Re: [PATCH v3 2/4] Network::network2bin: return an empty list in case of error
Hello,
did you check if any other functions need to be changed in order to reflect this change?
Many functions use the output of this one.
-Michael
On Wed, 2018-02-14 at 20:35 +0100, Bernhard Held wrote:
'return undef;' will always return a single value 'undef' even in list context.
sub foo { return undef } if ( my @x = foo() ) { print "oops, we think we got a result"; }
config/cfgroot/network-functions.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 070e14d0f..7cd56f799 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -139,7 +139,7 @@ sub network2bin($) { my $netmask_bin = &ip2bin($netmask);
if (!defined $address_bin || !defined $netmask_bin) {
return undef;
return ();
}
my $network_start = $address_bin & $netmask_bin;