Re: [PATCH 33/83] builtin/apply: move 'root' global into 'struct apply_state'

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

 



On Mon, Apr 25, 2016 at 11:50 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> On Sun, Apr 24, 2016 at 6:33 AM, Christian Couder
> <christian.couder@xxxxxxxxx> wrote:
>
>> @@ -4630,9 +4644,10 @@ static int option_parse_whitespace(const struct option *opt,
>>  static int option_parse_directory(const struct option *opt,
>>                                   const char *arg, int unset)
>>  {
>> -       strbuf_reset(&root);
>> -       strbuf_addstr(&root, arg);
>> -       strbuf_complete(&root, '/');
>> +       struct apply_state *state = opt->value;
>
> Or even
>
>     struct strbuf root = ((state*)opt->value)->root;
>
> and then keep the next lines as is?

I found it more coherent to have all the option_parse_*() functions do:

    struct apply_state *state = opt->value;

as their first instruction.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]