Re: [PATCH 4/4] format-rev: learn --abbrev, --color, and --date
Junio C Hamano <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
"Kristoffer Haugsbakk" <[email protected]> writes: > static int format_nul_cb(const struct option *option, > const char *arg, > int unset) > { > struct format_rev_data *data = option->value; > data->nul_input = 1; > data->nul_output = 1; > BUG_ON_OPT_NEG(unset); > BUG_ON_OPT_ARG(arg); > return 0; > } > > But this does not have the `NULL` deref. problem since we just > unconditionally set two boolean values. Still, for readability it’s > better for these two statements to go at the start. Since they are > preconditions. I will add this as a patch/commit to the series. Yeah, it would be a good idea to establish the "validate before doing anything with the parameters" pattern. Thanks.