Re: [PATCH 1/6] config: add helper function for parsing key names
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 18, 2013, 20:53 UTC
- Message-ID
- <7va9s6qkkz.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vehhm4bof.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes: > >> ... did you have any comment on >> the "struct config_key" alternative I sent as a follow-up? > > I did read it but I cannot say I did so very carefully. My gut > reaction was that the "take the variable name and section name, > return the subsection name pointer and length, if there is any, and > the key" made it readable enough. The proposed interface to make > and lend a copy to the caller does make it more readble, but I do > not know if that is worth doing. Neutral-to-slightly-in-favor, I > would say.
Now I re-read that "struct config_key" thing, I would have to say that the idea of giving split and NUL-terminated strings to the callers is good, but the "cheat" looks somewhat brittle for all the reasons that come from using a static buffer (which you already mentioned). As I do not offhand think of a better alternative, I'd say we leave it for another day.