On Thu, Apr 19, 2018 at 11:47:50AM +0900, Junio C Hamano wrote: > Taylor Blau <m...@ttaylorr.com> writes: > > > diff --git a/builtin/config.c b/builtin/config.c > > index 92fb8d56b1..bd7a8d0ce7 100644 > > --- a/builtin/config.c > > +++ b/builtin/config.c > > @@ -61,6 +61,58 @@ static int show_origin; > > #define TYPE_PATH 4 > > #define TYPE_EXPIRY_DATE 5 > > > > +#define OPT_CALLBACK_VALUE(s, l, v, h, i) \ > > + { OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \ > > + PARSE_OPT_NONEG, option_parse_type, (i) } > > + > > +static struct option builtin_config_options[]; > > + > > +static int option_parse_type(const struct option *opt, const char *arg, > > + int unset) > > +{ > > Declare all local variables here. We do not accept decl-after-statement.
My apologies, I will read Documentation/CodingGuidelines carefully. I have generated the following patch locally: diff --git a/builtin/config.c b/builtin/config.c index bd7a8d0ce7..2f91ef15a4 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -70,6 +70,9 @@ static struct option builtin_config_options[]; static int option_parse_type(const struct option *opt, const char *arg, int unset) { + int new_type; + int *to_type; + if (unset) { *((int *) opt->value) = 0; return 0; @@ -79,7 +82,7 @@ static int option_parse_type(const struct option *opt, const char *arg, * To support '--<type>' style flags, begin with new_type equal to * opt->defval. */ - int new_type = opt->defval; + new_type = opt->defval; if (!new_type) { if (!strcmp(arg, "bool")) new_type = TYPE_BOOL; @@ -95,7 +98,7 @@ static int option_parse_type(const struct option *opt, const char *arg, die(_("unrecognized --type argument, %s"), arg); } - int *to_type = opt->value; + *to_type = opt->value; if (*to_type && *to_type != new_type) { /* * Complain when there is a new type not equal to the old type. --- And would be happy to apply it locally myself and send it to you via a re-roll. You are also free to apply it yourself if it would be easier. I do not have a preference one way or another. Thanks, Taylor