Re: [PATCH 1/4] config: factor out config file stack management
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 26, 2013, 22:10 UTC
- Message-ID
- <7vobf6loas.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130226201518.GC13830@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 26 quoted lines
> I wonder if it would be more obvious with the more usual OO-struct
> functions, like:
>
> struct config_source {
> ...
> };
> void config_source_init_file(struct config_source *, const char *fn);
> void config_source_init_strbuf(struct config_source *,
> const struct strbuf *buf);
> void config_source_clear(struct config_source *);
>
> int config_source_parse(struct config_source *);
>
> and then the use would be something like:
>
> struct config_source top;
> int ret;
>
> config_source_init_file(&top, "foo");
> ret = config_source_parse(&top);
> config_source_clear(&top);
>
> return ret;
>
> I.e., "init" constructors, a "clear" destructor, and any methods like
> "parse" that you need.Yup, that cocincides with my first impression I sent out for the previous RFC/PATCH round.