changeset 107338:feb1bc86a749

Make it possible to C-g in a tight bytecode loop again (bug#5680). * lisp.h (ELSE_PENDING_SIGNALS): New macro. (QUIT): Use it to consolidate code and remove redundancy. * bytecode.c (BYTE_CODE_QUIT): Use it as well.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 05 Mar 2010 18:08:18 -0500
parents df618c2d11bb
children 51227b0f95e1
files src/ChangeLog src/bytecode.c src/lisp.h
diffstat 3 files changed, 13 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Mar 05 15:18:20 2010 -0500
+++ b/src/ChangeLog	Fri Mar 05 18:08:18 2010 -0500
@@ -1,5 +1,10 @@
 2010-03-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	Make it possible to C-g in a tight bytecode loop again (bug#5680).
+	* lisp.h (ELSE_PENDING_SIGNALS): New macro.
+	(QUIT): Use it to consolidate code and remove redundancy.
+	* bytecode.c (BYTE_CODE_QUIT): Use it as well.
+
 	* regex.c (regex_compile): Setup gl_state as well.
 
 	* syntax.c (skip_chars): Setup gl_state (bug#3823).
--- a/src/bytecode.c	Fri Mar 05 15:18:20 2010 -0500
+++ b/src/bytecode.c	Fri Mar 05 18:08:18 2010 -0500
@@ -393,6 +393,7 @@
 	Fsignal (Qquit, Qnil);				\
 	AFTER_POTENTIAL_GC ();				\
       }							\
+    ELSE_PENDING_SIGNALS				\
   } while (0)
 
 
--- a/src/lisp.h	Fri Mar 05 15:18:20 2010 -0500
+++ b/src/lisp.h	Fri Mar 05 18:08:18 2010 -0500
@@ -1933,6 +1933,12 @@
 #ifdef SYNC_INPUT
 extern void process_pending_signals P_ ((void));
 extern int pending_signals;
+#define ELSE_PENDING_SIGNALS				\
+  else if (pending_signals)				\
+    process_pending_signals ();
+#else  /* not SYNC_INPUT */
+#define ELSE_PENDING_SIGNALS
+#endif	/* not SYNC_INPUT */
 
 #define QUIT						\
   do {							\
@@ -1944,26 +1950,9 @@
 	  Fthrow (Vthrow_on_input, Qt);			\
 	Fsignal (Qquit, Qnil);				\
       }							\
-    else if (pending_signals)				\
-      process_pending_signals ();			\
+    ELSE_PENDING_SIGNALS				\
   } while (0)
 
-#else  /* not SYNC_INPUT */
-
-#define QUIT						\
-  do {							\
-    if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
-      {							\
-        Lisp_Object flag = Vquit_flag;			\
-	Vquit_flag = Qnil;				\
-	if (EQ (Vthrow_on_input, flag))			\
-	  Fthrow (Vthrow_on_input, Qt);			\
-	Fsignal (Qquit, Qnil);				\
-      }							\
-  } while (0)
-
-#endif	/* not SYNC_INPUT */
-
 
 /* Nonzero if ought to quit now.  */