git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Keller, Jacob E <jacob.e.keller@intel.com>
Date
Jul 16, 2014, 19:50 UTC
Message-ID
<1405540201.15392.3.camel@jekeller-desk1.amr.corp.intel.com>
In-Reply-To
<CAPc5daUhmeucDOakXpR_ViS0cfFDEyXUD_xoeP6qeCg33dW+1A@mail.gmail.com>

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 mind either approach.

Thanks, Jake

On Tue, 2014-07-15 at 17:49 -0700, Junio C Hamano wrote:
Show 34 quoted lines
> 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;
>  - set error/warning routines back to their original; and
>  - return from it
> 
> at least in the code paths under discussion?
> 
> 
> On Tue, Jul 15, 2014 at 4:26 PM, Keller, Jacob E
> <jacob.e.keller@intel.com> wrote:
> > On Tue, 2014-07-15 at 15:47 -0700, Junio C Hamano wrote:
> >> Jacob Keller <jacob.e.keller@intel.com> 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 set_error_routine() as well by forcing the system not to
> >> link when they are merged without necessary fixes.
> >>
> >
> > Also curious what your thoughts on making every set_*_routine to be a
> > stack? For now I was only planning on error but it maybe makes sense to
> > change them all?
> >
> > Thanks,
> > Jake
> >
Previous: Junio C HamanoNext: Jacob Keller
Message 7 of 11 in “tag: configure default tag sort via .gitconfig”
  1. 0/4 tag: configure default tag sort via .gitconfigJacob Keller, Jul 15, 2014
  2. 1/4 usage: make error functions a stackJacob Keller, Jul 15, 2014
  3. Junio C HamanoJul 15, 2014
  4. Keller, Jacob EJul 15, 2014
  5. Keller, Jacob EJul 15, 2014
  6. Junio C HamanoJul 16, 2014
  7. Keller, Jacob EJul 16, 2014
  8. 2/4 tag: fix --sort tests to use cat<<-\EOF formatJacob Keller, Jul 15, 2014
  9. 3/4 tag: update parsing to be more precise regarding errorsJacob Keller, Jul 15, 2014
  10. 4/4 tag: support configuring --sort via .gitconfigJacob Keller, Jul 15, 2014
  11. Junio C HamanoJul 15, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.