Re: [PATCH v8 1/4] usage: make error functions a stack

2014-07-16 Thread Keller, Jacob E
There was no way to get the current error routine now, and I figured that a stack was a simple way of saving the old routine. Essentially these two paths would be the same as a "save/restore" except we manage it via a stack. I don't really see how that would end up any different. I mean I don't mi

Re: [PATCH v8 1/4] usage: make error functions a stack

2014-07-15 Thread Junio C Hamano
I actually am not a big fan of "stack" for a thing like this, to be honest. Wouldn't it be sufficient for the callers who want specific behaviour from its callees to - save away the current error/warning routines; - set error/warning routines to its own custom versions; - call the callees; - s

Re: [PATCH v8 1/4] usage: make error functions a stack

2014-07-15 Thread Keller, Jacob E
On Tue, 2014-07-15 at 15:47 -0700, Junio C Hamano wrote: > Jacob Keller writes: > > > extern void set_error_routine(void (*routine)(const char *err, va_list > > params)); > > +extern void pop_error_routine(void); > > pop that undoes set smells somewhat weird. Perhaps we should rename > set to

Re: [PATCH v8 1/4] usage: make error functions a stack

2014-07-15 Thread Keller, Jacob E
On Tue, 2014-07-15 at 15:47 -0700, Junio C Hamano wrote: > Jacob Keller writes: > > > extern void set_error_routine(void (*routine)(const char *err, va_list > > params)); > > +extern void pop_error_routine(void); > > pop that undoes set smells somewhat weird. Perhaps we should rename > set to

Re: [PATCH v8 1/4] usage: make error functions a stack

2014-07-15 Thread Junio C Hamano
Jacob Keller writes: > extern void set_error_routine(void (*routine)(const char *err, va_list > params)); > +extern void pop_error_routine(void); pop that undoes set smells somewhat weird. Perhaps we should rename set to push? That would allow us catch possible topics that add new calls to s

[PATCH v8 1/4] usage: make error functions a stack

2014-07-15 Thread Jacob Keller
Let error routine be a stack of error functions so that callers can temporarily override the error_routine and then pop their modification off the stack. This enables customizing error for a small code segment. Signed-off-by: Jacob Keller --- This is a modification of Peff's original idea for han