Re: [PATCH v2 11/14] config: pass kvi to die_bad_number()
- From
Glen Choo <chooglen@google.com>
- Date
- Jun 2, 2023, 17:23 UTC
- Message-ID
- <kl6lpm6dzskk.fsf@chooglen-macbookpro.roam.corp.google.com>
- In-Reply-To
- <20230601234829.432150-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 13 quoted lines
> "Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes: >> Outside of config.c, config callbacks now need to pass "kvi" to any of >> the git_config_<type>() functions that parse a config string into a >> number type. Included is a .cocci patch to make that refactor. In cases >> where "kvi" would never be used, pass NULL, e.g.: >> >> - In config.c, when we are parsing a boolean instead of a number >> - In builtin/config.c, when calling normalize_value() before setting >> config to something the user gave us. > > In these cases, could we synthesize a kvi instead of using NULL? I > believe there are already code paths that use an UNKNOWN scope - these > seem similar to that.
Okay, that sounds reasonable. This has echoes of Philip Wood's suggestion (elsewhere in the thread) of combining all of the config_fn_t args into a single struct, which means we can no longer use NULL as the default.