On Sun, 01 Oct 2017, William Casarin <[email protected]> wrote:
> Jani Nikula <[email protected]> writes:
>
>> @@ -171,11 +186,22 @@ parse_option (int argc, char **argv, const 
>> notmuch_opt_desc_t *options, int opt_
>>      if (! try->name)
>>          continue;
>>  
>> -    if (strncmp (arg, try->name, strlen (try->name)) != 0)
>> +    char next;
>> +    const char *value;
>> +    notmuch_bool_t negate = FALSE;
>> +
>> +    if (strncmp (arg, try->name, strlen (try->name)) == 0) {
>> +        next = arg[strlen (try->name)];
>> +        value = arg + strlen (try->name) + 1;
>> +    } else if (negative_arg && (try->opt_bool || try->opt_flags) &&
>> +               strncmp (negative_arg, try->name, strlen (try->name)) == 0) {
>> +        next = negative_arg[strlen (try->name)];
>> +        value = negative_arg + strlen (try->name) + 1;
>> +        /* The argument part of --no-argument matches, negate the result. */
>> +        negate = TRUE;
>> +    } else {
>>          continue;
>> -
>> -    char next = arg[strlen (try->name)];
>> -    const char *value = arg + strlen(try->name) + 1;
>> +    }
>
> nit: I see strlen (try->name) computed 6 times here, any reason not to pull
> this out into a variable?

I pretty much thought the change was so controversial that I wouldn't
bother with that kind of fixes until we'd agreed we want this. Other
than that, agreed.

BR,
Jani.
_______________________________________________
notmuch mailing list
[email protected]
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to