From: Junio C Hamano Date: Thu, 26 Apr 2018 09:49:46 GMT Subject: Re: [PATCH v2 2/5] builtin/config.c: support `--type=` as preferred alias for `--` Message-ID: In-Reply-To: <404da8bdeb9808d2dfcfdf09bc62c76195c9a08c.1524722247.git.me@ttaylorr.com> Taylor Blau writes: > +static int option_parse_type(const struct option *opt, const char *arg, > + int unset) > +{ > + /* > + * To support '--' style flags, begin with new_type equal to > + * opt->defval. > + */ > + int new_type = opt->defval; > + int *to_type = opt->value; > + > + if (unset) { > + *((int *) opt->value) = 0; As you moved the definition of to_type higher than the previous rounds, you can already use it here to avoid cryptic casting, i.e. *to_type = 0; no? > + return 0; > + }