Message ID | 20180214193522.26880-3-berny156@gmx.de |
---|---|
State | Dropped |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id 8B93960C10 for <patchwork@web02.i.ipfire.org>; Wed, 14 Feb 2018 20:35:54 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 018DC105FC87; Wed, 14 Feb 2018 19:35:58 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4F097105FC89 for <development@lists.ipfire.org>; Wed, 14 Feb 2018 19:35:53 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MDhny-1f0vl73QOU-00H7lm for <development@lists.ipfire.org>; Wed, 14 Feb 2018 20:35:32 +0100 From: Bernhard Held <berny156@gmx.de> To: development@lists.ipfire.org Subject: [PATCH v3 2/4] Network::network2bin: return an empty list in case of error Date: Wed, 14 Feb 2018 20:35:20 +0100 Message-Id: <20180214193522.26880-3-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@gmx.de> X-Provags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dZlp2SzgwhxaSU92BKjh /ZlRAIiFpPKAGjUxfIS3yNLNvZW1w== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <https://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
proxy.cgi fixes for bugzilla #10852
|
|
Commit Message
Bernhard Held
Feb. 15, 2018, 6:35 a.m. UTC
'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(-)
Comments
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;
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; >
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;