Re: [PATCH 2/2] parse-options.c: use "enum parse_opt_result" for parse_nodash_opt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

>>> -	return -2;
>>> +	return PARSE_OPT_ERROR;
>>>  }
>>
>> The current caller only checks to skip a token that yields 0 (aka
>> PARSE_OPT_DONE) and does not distinguish between other values, so
>> this won't change the behaviour of the current code, but it is 
>> not clear if returning -1 (aka PARSE_OPT_ERROR) is better than -2
>> (aka PARSE_OPT_HELP).
>
> I think PARSE_OPT_ERROR is probably better.
>
> It looks like the -2 return value might have been somewhat blindly
> copy/pasted between 07fe54db3cd (parse-opt: do not print errors on
> unknown options, return -2 intead., 2008-06-23) and 51a9949eda7
> (parseopt: add PARSE_OPT_NODASH, 2009-05-07).
>
> I.e. we use the full enum values for the code in the former, but in the
> latter we're just looking for "not zero", so error/-1 seemed like a
> better fit.

OK.  That sounds like a good explanation for the change, to be
recorded in the proposed log message.

Thanks.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux