David Ahern <[email protected]> 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.