emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] src/eval.c (Fapply): Remove unnecessary goto


From: Stefan Monnier
Subject: Re: [PATCH] src/eval.c (Fapply): Remove unnecessary goto
Date: Thu, 04 Dec 2014 14:18:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> @@ -1532,8 +1532,7 @@ See also the function `condition-case'.  */)
>    || NILP (clause)
>    /* A `debug' symbol in the handler list disables the normal
>       suppression of the debugger.  */
> -  || (CONSP (clause) && CONSP (clause)
> -      && !NILP (Fmemq (Qdebug, clause)))
> +  || (CONSP (clause) && !NILP (Fmemq (Qdebug, clause)))
>    /* Special handler that means "print a message and run debugger
>       if requested".  */
>    || EQ (h->tag_or_ch, Qerror)))

Oops, indeed.  Installed in emacs-24.

> + * eval.c (Fapply): Remove unnecessary goto.

Yes, that function was poorly structured.  I had some restructuring in
my local tree as well for a long time, so I took advantage of your patch
to do a more thorough job (installed in master).

> -      if (numargs < XSUBR (fun)->min_args
> -  || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
> - goto funcall; /* Let funcall get the error.  */
> -      else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs)
> +      if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs)

This is actually not quite right: you fail to test

   numargs < XSUBR (fun)->min_args

which means that you can end up adding args which are truly missing
(i.e. not optional).

> + * eval.c(Fbacktrace): Avoid unnecessary strlen calls.

I'm ambivalent on this one: printing the backtrace really shouldn't be
performance sensitive, and using -1 makes it easier to change the code.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]