lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k0v6hyv9.fsf@nvidia.com>
Date:   Sat, 31 Oct 2020 22:25:14 +0100
From:   Petr Machata <me@...chata.org>
To:     David Ahern <dsahern@...il.com>
Cc:     netdev@...r.kernel.org, stephen@...workplumber.org,
        john.fastabend@...il.com, jiri@...dia.com, idosch@...dia.com,
        Jakub Kicinski <kuba@...nel.org>,
        Roman Mashak <mrv@...atatu.com>
Subject: Re: [PATCH iproute2-next v2 02/11] lib: Add parse_one_of(), parse_on_off()


David Ahern <dsahern@...il.com> writes:

> On 10/30/20 6:29 AM, Petr Machata wrote:
>> +int parse_on_off(const char *msg, const char *realval, int *p_err)
>> +{
>> +	static const char * const values_on_off[] = { "off", "on" };
>> +
>> +	return parse_one_of(msg, realval, values_on_off, ARRAY_SIZE(values_on_off), p_err);
>> +}
>> 
>
> This has weird semantics to me. You have a buried array of strings and
> returning the index of the one that matches. Let's use a 'bool' return
> for parse_on_off that makes it clear that the string is 'off' = false or
> 'on' = true.

Agreed, it should return bool.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ