unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 629f980fad: Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments
       [not found] ` <20220815121939.5CBCBC0F1F3@vcs2.savannah.gnu.org>
@ 2022-08-15 14:28   ` Stefan Monnier
  2022-08-18 16:26     ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2022-08-15 14:28 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie

>  static Lisp_Object
>  safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args)
>  {
> -  eassert (nargs == 2);
> -  return call0 (args[1]);
> +  eassert (nargs >= 2 && nargs <= 4);
> +  switch (nargs)
> +    {
> +    case 2:
> +      return call0 (args[1]);
> +    case 3:
> +      return call1 (args[1], args[2]);
> +    default:
> +      return call2 (args[1], args[2], args[3]);
> +    }
>  }

Can't we do something like

    return Ffuncall (nargs - 1, args + 1);

?


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 629f980fad: Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments
  2022-08-15 14:28   ` master 629f980fad: Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments Stefan Monnier
@ 2022-08-18 16:26     ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-08-18 16:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, acm

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Alan Mackenzie <acm@muc.de>
> Date: Mon, 15 Aug 2022 10:28:56 -0400
> 
> >  static Lisp_Object
> >  safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args)
> >  {
> > -  eassert (nargs == 2);
> > -  return call0 (args[1]);
> > +  eassert (nargs >= 2 && nargs <= 4);
> > +  switch (nargs)
> > +    {
> > +    case 2:
> > +      return call0 (args[1]);
> > +    case 3:
> > +      return call1 (args[1], args[2]);
> > +    default:
> > +      return call2 (args[1], args[2], args[3]);
> > +    }
> >  }
> 
> Can't we do something like
> 
>     return Ffuncall (nargs - 1, args + 1);
> 
> ?

We could, but why do we need safe_run_hooks_1 at all?  Its only caller
could call Ffuncall directly, no?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-18 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <166056597907.22106.4183994272552532983@vcs2.savannah.gnu.org>
     [not found] ` <20220815121939.5CBCBC0F1F3@vcs2.savannah.gnu.org>
2022-08-15 14:28   ` master 629f980fad: Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments Stefan Monnier
2022-08-18 16:26     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).