Re: [PATCH v2 02/19] parse-options-cb: implement parse_opt_pass_argv_array()
- From
Paul Tan <pyokagan@gmail.com>
- Date
- Jun 10, 2015, 07:11 UTC
- Message-ID
- <CACRoPnRVjNseXPOxKe4_3rnKXmAYeA80iCHY3o8euWA=EUX6hA@mail.gmail.com>
- In-Reply-To
- <xmqqr3pkwjz6.fsf@gitster.dls.corp.google.com>
On Wed, Jun 10, 2015 at 7:16 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Almost the same comment as 01/19 applies to this comment. > > I think it makes good sense to have two variants, one that lets the > last one win and pass only that last one (i.e. 01/19) and the other > that accumulates them into an argv_array (i.e. this one). But it > feels iffy, given that the "acculate" version essentially creates an > array of (char *), to make "the last one wins, leaving a single > string" to use strbuf. I'd find it much more understandable if 01/19 > took (char **) as opt->value instead of a strbuf.
I don't see how it feels iffy. The purpose of using strbufs (and argv_arrays) is to avoid error-prone manual memory management.
> In any case, these two need to be added as a related pair to the API > documentation.
Okay, I guess I could also add their macro functions as well.
Thanks, Paul