Re: [PATCH 33/83] builtin/apply: move 'root' global into 'struct apply_state'
On Mon, Apr 25, 2016 at 11:50 PM, Stefan Beller <sbeller@google.com> wrote:
Show 17 quoted lines
> On Sun, Apr 24, 2016 at 6:33 AM, Christian Couder
> <christian.couder@gmail.com> 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.