Re: [PATCH v2 03/14] (RFC-only) config: add kvi arg to config_fn_t
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jun 5, 2023, 09:38 UTC
- Message-ID
- <1ca04355-8faf-e7f9-051f-a6a568ff99c5@gmail.com>
- In-Reply-To
- <kl6lv8g5zu9v.fsf@chooglen-macbookpro.roam.corp.google.com>
On 02/06/2023 17:46, Glen Choo wrote:
Show 16 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes: >> As an aside, I think we'd also want a couple of helpers for matching >> keys so we can just write kvi_match_key(kvi, "user.name") or >> kvi_skip_key_prefix(kvi, "core.", &p) rather than having to extract the >> key name first. > > Yes, and that would also abstract over implementation details like > matching keys using strcasecmp() and not strcmp(). For reasons like > this, I think your proposal paves the way for a harder-to-misuse API. > > I still have some nagging, probably irrational fear that consolidating > all of the config_fn_t args is trickier to manage than adding a single > key_value_info arg. It definitely *sounds* trickier, but I can't really > think of a real downside. > > Maybe I just have to try it and send the result for others to consider.
That's probably the best way to see if it is an improvement - you can always blame me if it turns out not to be! Hopefully it isn't too much work to add enough api to be able to convert a couple of config_fn_t functions to see how it pans out.
Best Wishes
Phillip