aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-19 18:37:07 -0700
committerPaul Eggert2012-09-19 18:37:07 -0700
commitf75beb4787372df3dcc50cbb07407f45ff04bf04 (patch)
tree19a41069b797bb16623d630b35343525f6172f01 /src/keyboard.c
parentb019b76a181d6af0c73559b73f9735b91bc71d21 (diff)
downloademacs-f75beb4787372df3dcc50cbb07407f45ff04bf04.tar.gz
emacs-f75beb4787372df3dcc50cbb07407f45ff04bf04.zip
Omit unused arg EXPECTED from socket hooks.
* keyboard.c (gobble_input, read_avail_input, tty_read_avail_input): * nsterm.m (ns_term_init): * termhooks.h (struct terminal.read_socket_hook): * w32inevt.c (w32_console_read_socket): * w32term.c (w32_read_socket): * xterm.c (XTread_socket): Omit unused arg EXPECTED. All callers changed. (store_user_signal_events): Return void, not int, since callers no longer care about the return value. All uses changed.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 01644b3832d..098d3530ef8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -413,7 +413,7 @@ static EMACS_TIME timer_last_idleness_start_time;
413/* Function for init_keyboard to call with no args (if nonzero). */ 413/* Function for init_keyboard to call with no args (if nonzero). */
414static void (*keyboard_init_hook) (void); 414static void (*keyboard_init_hook) (void);
415 415
416static int read_avail_input (int); 416static int read_avail_input (void);
417static void get_input_pending (int *, int); 417static void get_input_pending (int *, int);
418static int readable_events (int); 418static int readable_events (int);
419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, 419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
@@ -448,7 +448,7 @@ static void timer_stop_idle (void);
448static void timer_resume_idle (void); 448static void timer_resume_idle (void);
449static void deliver_user_signal (int); 449static void deliver_user_signal (int);
450static char *find_user_signal_name (int); 450static char *find_user_signal_name (int);
451static int store_user_signal_events (void); 451static void store_user_signal_events (void);
452 452
453/* These setters are used only in this file, so they can be private. */ 453/* These setters are used only in this file, so they can be private. */
454static inline void 454static inline void
@@ -2010,7 +2010,7 @@ poll_for_input_1 (void)
2010{ 2010{
2011 if (interrupt_input_blocked == 0 2011 if (interrupt_input_blocked == 0
2012 && !waiting_for_input) 2012 && !waiting_for_input)
2013 read_avail_input (0); 2013 read_avail_input ();
2014} 2014}
2015 2015
2016/* Timer callback function for poll_timer. TIMER is equal to 2016/* Timer callback function for poll_timer. TIMER is equal to
@@ -3843,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3843 interrupt handlers have not read it, read it now. */ 3843 interrupt handlers have not read it, read it now. */
3844 3844
3845#ifdef USABLE_SIGIO 3845#ifdef USABLE_SIGIO
3846 gobble_input (0); 3846 gobble_input ();
3847#endif 3847#endif
3848 if (kbd_fetch_ptr != kbd_store_ptr) 3848 if (kbd_fetch_ptr != kbd_store_ptr)
3849 break; 3849 break;
@@ -3869,8 +3869,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3869 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); 3869 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
3870 3870
3871 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) 3871 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
3872 /* Pass 1 for EXPECT since we just waited to have input. */ 3872 read_avail_input ();
3873 read_avail_input (1);
3874 } 3873 }
3875 3874
3876 if (CONSP (Vunread_command_events)) 3875 if (CONSP (Vunread_command_events))
@@ -6734,14 +6733,14 @@ get_input_pending (int *addr, int flags)
6734 return; 6733 return;
6735 6734
6736 /* Try to read some input and see how much we get. */ 6735 /* Try to read some input and see how much we get. */
6737 gobble_input (0); 6736 gobble_input ();
6738 *addr = (!NILP (Vquit_flag) || readable_events (flags)); 6737 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6739} 6738}
6740 6739
6741/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ 6740/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
6742 6741
6743void 6742void
6744gobble_input (int expected) 6743gobble_input (void)
6745{ 6744{
6746#ifdef USABLE_SIGIO 6745#ifdef USABLE_SIGIO
6747 if (interrupt_input) 6746 if (interrupt_input)
@@ -6750,7 +6749,7 @@ gobble_input (int expected)
6750 sigemptyset (&blocked); 6749 sigemptyset (&blocked);
6751 sigaddset (&blocked, SIGIO); 6750 sigaddset (&blocked, SIGIO);
6752 pthread_sigmask (SIG_BLOCK, &blocked, &procmask); 6751 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6753 read_avail_input (expected); 6752 read_avail_input ();
6754 pthread_sigmask (SIG_SETMASK, &procmask, 0); 6753 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6755 } 6754 }
6756 else 6755 else
@@ -6764,13 +6763,13 @@ gobble_input (int expected)
6764 sigemptyset (&blocked); 6763 sigemptyset (&blocked);
6765 sigaddset (&blocked, SIGALRM); 6764 sigaddset (&blocked, SIGALRM);
6766 pthread_sigmask (SIG_BLOCK, &blocked, &procmask); 6765 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6767 read_avail_input (expected); 6766 read_avail_input ();
6768 pthread_sigmask (SIG_SETMASK, &procmask, 0); 6767 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6769 } 6768 }
6770 else 6769 else
6771#endif 6770#endif
6772#endif 6771#endif
6773 read_avail_input (expected); 6772 read_avail_input ();
6774} 6773}
6775 6774
6776/* Put a BUFFER_SWITCH_EVENT in the buffer 6775/* Put a BUFFER_SWITCH_EVENT in the buffer
@@ -6826,15 +6825,14 @@ record_asynch_buffer_change (void)
6826 this is a bad time to try to read input. */ 6825 this is a bad time to try to read input. */
6827 6826
6828static int 6827static int
6829read_avail_input (int expected) 6828read_avail_input (void)
6830{ 6829{
6831 int nread = 0; 6830 int nread = 0;
6832 int err = 0; 6831 int err = 0;
6833 struct terminal *t; 6832 struct terminal *t;
6834 6833
6835 /* Store pending user signal events, if any. */ 6834 /* Store pending user signal events, if any. */
6836 if (store_user_signal_events ()) 6835 store_user_signal_events ();
6837 expected = 0;
6838 6836
6839 /* Loop through the available terminals, and call their input hooks. */ 6837 /* Loop through the available terminals, and call their input hooks. */
6840 t = terminal_list; 6838 t = terminal_list;
@@ -6851,11 +6849,8 @@ read_avail_input (int expected)
6851 hold_quit.kind = NO_EVENT; 6849 hold_quit.kind = NO_EVENT;
6852 6850
6853 /* No need for FIONREAD or fcntl; just say don't wait. */ 6851 /* No need for FIONREAD or fcntl; just say don't wait. */
6854 while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0) 6852 while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
6855 { 6853 nread += nr;
6856 nread += nr;
6857 expected = 0;
6858 }
6859 6854
6860 if (nr == -1) /* Not OK to read input now. */ 6855 if (nr == -1) /* Not OK to read input now. */
6861 { 6856 {
@@ -6950,7 +6945,6 @@ decode_keyboard_code (struct tty_display_info *tty,
6950 6945
6951int 6946int
6952tty_read_avail_input (struct terminal *terminal, 6947tty_read_avail_input (struct terminal *terminal,
6953 int expected,
6954 struct input_event *hold_quit) 6948 struct input_event *hold_quit)
6955{ 6949{
6956 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than 6950 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
@@ -7170,8 +7164,7 @@ handle_async_input (void)
7170 7164
7171 while (1) 7165 while (1)
7172 { 7166 {
7173 int nread; 7167 int nread = read_avail_input ();
7174 nread = read_avail_input (1);
7175 /* -1 means it's not ok to read the input now. 7168 /* -1 means it's not ok to read the input now.
7176 UNBLOCK_INPUT will read it later; now, avoid infinite loop. 7169 UNBLOCK_INPUT will read it later; now, avoid infinite loop.
7177 0 means there was no keyboard input available. */ 7170 0 means there was no keyboard input available. */
@@ -7323,25 +7316,25 @@ find_user_signal_name (int sig)
7323 return NULL; 7316 return NULL;
7324} 7317}
7325 7318
7326static int 7319static void
7327store_user_signal_events (void) 7320store_user_signal_events (void)
7328{ 7321{
7329 struct user_signal_info *p; 7322 struct user_signal_info *p;
7330 struct input_event buf; 7323 struct input_event buf;
7331 int nstored = 0; 7324 bool buf_initialized = 0;
7332 7325
7333 for (p = user_signals; p; p = p->next) 7326 for (p = user_signals; p; p = p->next)
7334 if (p->npending > 0) 7327 if (p->npending > 0)
7335 { 7328 {
7336 sigset_t blocked, procmask; 7329 sigset_t blocked, procmask;
7337 7330
7338 if (nstored == 0) 7331 if (! buf_initialized)
7339 { 7332 {
7340 memset (&buf, 0, sizeof buf); 7333 memset (&buf, 0, sizeof buf);
7341 buf.kind = USER_SIGNAL_EVENT; 7334 buf.kind = USER_SIGNAL_EVENT;
7342 buf.frame_or_window = selected_frame; 7335 buf.frame_or_window = selected_frame;
7336 buf_initialized = 1;
7343 } 7337 }
7344 nstored += p->npending;
7345 7338
7346 sigemptyset (&blocked); 7339 sigemptyset (&blocked);
7347 sigaddset (&blocked, p->sig); 7340 sigaddset (&blocked, p->sig);
@@ -7357,8 +7350,6 @@ store_user_signal_events (void)
7357 7350
7358 pthread_sigmask (SIG_SETMASK, &procmask, 0); 7351 pthread_sigmask (SIG_SETMASK, &procmask, 0);
7359 } 7352 }
7360
7361 return nstored;
7362} 7353}
7363 7354
7364 7355