Inline maybe_quit
Since `maybe_quit` is called on many critical paths, inline a slightly cheaper condition (that ignores Vinhibit_quit). * src/eval.c (maybe_quit): Rename to `probably_quit`. * src/lisp.h (maybe_quit): New simplified inline function.
This commit is contained in:
parent
b7902a9b48
commit
a8b713d83a
3 changed files with 26 additions and 16 deletions
|
@ -33,6 +33,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|||
#include "charset.h"
|
||||
#include "ccl.h"
|
||||
#include "coding.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
/* Table of registered CCL programs. Each element is a vector of
|
||||
NAME, CCL_PROG, RESOLVEDP, and UPDATEDP, where NAME (symbol) is the
|
||||
|
|
15
src/eval.c
15
src/eval.c
|
@ -1737,21 +1737,8 @@ process_quit_flag (void)
|
|||
quit ();
|
||||
}
|
||||
|
||||
/* Check quit-flag and quit if it is non-nil. Typing C-g does not
|
||||
directly cause a quit; it only sets Vquit_flag. So the program
|
||||
needs to call maybe_quit at times when it is safe to quit. Every
|
||||
loop that might run for a long time or might not exit ought to call
|
||||
maybe_quit at least once, at a safe place. Unless that is
|
||||
impossible, of course. But it is very desirable to avoid creating
|
||||
loops where maybe_quit is impossible.
|
||||
|
||||
If quit-flag is set to `kill-emacs' the SIGINT handler has received
|
||||
a request to exit Emacs when it is safe to do.
|
||||
|
||||
When not quitting, process any pending signals. */
|
||||
|
||||
void
|
||||
maybe_quit (void)
|
||||
probably_quit (void)
|
||||
{
|
||||
if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
|
||||
process_quit_flag ();
|
||||
|
|
26
src/lisp.h
26
src/lisp.h
|
@ -3422,12 +3422,34 @@ struct handler
|
|||
|
||||
extern Lisp_Object memory_signal_data;
|
||||
|
||||
extern void maybe_quit (void);
|
||||
|
||||
/* True if ought to quit now. */
|
||||
|
||||
#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
|
||||
|
||||
extern bool volatile pending_signals;
|
||||
extern void process_pending_signals (void);
|
||||
extern void probably_quit (void);
|
||||
|
||||
/* Check quit-flag and quit if it is non-nil. Typing C-g does not
|
||||
directly cause a quit; it only sets Vquit_flag. So the program
|
||||
needs to call maybe_quit at times when it is safe to quit. Every
|
||||
loop that might run for a long time or might not exit ought to call
|
||||
maybe_quit at least once, at a safe place. Unless that is
|
||||
impossible, of course. But it is very desirable to avoid creating
|
||||
loops where maybe_quit is impossible.
|
||||
|
||||
If quit-flag is set to `kill-emacs' the SIGINT handler has received
|
||||
a request to exit Emacs when it is safe to do.
|
||||
|
||||
When not quitting, process any pending signals. */
|
||||
|
||||
INLINE void
|
||||
maybe_quit (void)
|
||||
{
|
||||
if (!NILP (Vquit_flag) || pending_signals)
|
||||
probably_quit ();
|
||||
}
|
||||
|
||||
/* Process a quit rarely, based on a counter COUNT, for efficiency.
|
||||
"Rarely" means once per USHRT_MAX + 1 times; this is somewhat
|
||||
arbitrary, but efficient. */
|
||||
|
|
Loading…
Add table
Reference in a new issue