Re: [PATCH 39/83] builtin/apply: move 'ws_error_action' into 'struct apply_state'
From: Junio C Hamano <hidden>
Date: 2016-06-16 02:19:00
Junio C Hamano [off-list ref] writes:
As I do not expect that cmd_apply() which is a moral equivalent of
main() will stay to be the only one who wants to see a reasonably
initialized apply_state(), I think the patch that introduced the
very first version of "struct apply_state" should also introduce a
helper function to initialize it, i.e.
static void init_apply_state(struct apply_state *s,
const char *prefix)
{
memset(s, '\0', sizeof(*s));
s->prefix = prefix;
s->prefix_length = s->prefix ? strlen(s->prefix) : 0;
}
in [PATCH 7/xx].
Just to avoid misunderstanding, I do not mean to say that the
init-apply-state helper that should have been introduced in 07/xx
would gain a new caller-supplied parameter ws_error_action. This
step would have a patch to the function that does something like:
static void init_apply_state(struct apply_state *s,
const char *prefix)
{
memset(s, '\0', sizeof(*s));
s->prefix = prefix;
s->prefix_length = s->prefix ? strlen(s->prefix) : 0;
...
+ s->ws_error_action = warn_on_ws_error;
}
without having the caller supply what error_action should the state
be initialized with.