Re: [PATCH v2 3/4] config: make parsing stack struct independent from actual data source

2013-03-12 Thread Jeff King
On Tue, Mar 12, 2013 at 05:27:35PM +0100, Heiko Voigt wrote: > > Would a union be more appropriate here? We do not ever have to pass it > > directly as a parameter, since we pass the "struct config_source" to the > > method functions. > > > > It's still possible to screw up using a union, but it'

Re: [PATCH v2 3/4] config: make parsing stack struct independent from actual data source

2013-03-12 Thread Heiko Voigt
On Tue, Mar 12, 2013 at 07:03:55AM -0400, Jeff King wrote: > On Sun, Mar 10, 2013 at 05:59:40PM +0100, Heiko Voigt wrote: > > > diff --git a/config.c b/config.c > > index f55c43d..fe1c0e5 100644 > > --- a/config.c > > +++ b/config.c > > @@ -10,20 +10,42 @@ > > #include "strbuf.h" > > #include "q

Re: [PATCH v2 3/4] config: make parsing stack struct independent from actual data source

2013-03-12 Thread Jeff King
On Sun, Mar 10, 2013 at 05:59:40PM +0100, Heiko Voigt wrote: > diff --git a/config.c b/config.c > index f55c43d..fe1c0e5 100644 > --- a/config.c > +++ b/config.c > @@ -10,20 +10,42 @@ > #include "strbuf.h" > #include "quote.h" > > -typedef struct config_file { > - struct config_file *prev;

[PATCH v2 3/4] config: make parsing stack struct independent from actual data source

2013-03-10 Thread Heiko Voigt
To simplify adding other sources we extract all functions needed for parsing into a list of callbacks. We implement those callbacks for the current file parsing. A new source can implement its own set of callbacks. Instead of storing the concrete FILE pointer for parsing we store a void pointer. A