Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 1/4] config: factor out config file stack management

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:16

Jeff King [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help