]> git.eshelyaron.com Git - emacs.git/commitdiff
Omit unused arg EXPECTED from socket hooks.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 20 Sep 2012 01:37:07 +0000 (18:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 20 Sep 2012 01:37:07 +0000 (18:37 -0700)
* 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.

src/ChangeLog
src/dispnew.c
src/keyboard.c
src/keyboard.h
src/nsterm.m
src/termhooks.h
src/w32inevt.c
src/w32inevt.h
src/w32term.c
src/xterm.c

index 2ee57d8531c45fbc0cd74acc6d48e5b758ea56de..7f9cac9fa21b8baa201ed8c3b4f65a9e2fa6c2dc 100644 (file)
@@ -1,3 +1,16 @@
+2012-09-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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.
+
 2012-09-20  Juanma Barranquero  <lekktu@gmail.com>
 
        * w32gui.h (XParseGeometry): Do not declare.
index 5827316a7b74ba84c1f03287b72630928dfdd877..fc966581adb2fbf2dff9f06b157c4eee51fdb632 100644 (file)
@@ -5971,7 +5971,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
 
 
 #ifdef USABLE_SIGIO
-  gobble_input (0);
+  gobble_input ();
 #endif
 
   wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display,
index 01644b3832dd7e20befc4a423dd7054f3243a646..098d3530ef845d267ed5c09d19d8c3e6d6f70ec3 100644 (file)
@@ -413,7 +413,7 @@ static EMACS_TIME timer_last_idleness_start_time;
 /* Function for init_keyboard to call with no args (if nonzero).  */
 static void (*keyboard_init_hook) (void);
 
-static int read_avail_input (int);
+static int read_avail_input (void);
 static void get_input_pending (int *, int);
 static int readable_events (int);
 static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
@@ -448,7 +448,7 @@ static void timer_stop_idle (void);
 static void timer_resume_idle (void);
 static void deliver_user_signal (int);
 static char *find_user_signal_name (int);
-static int store_user_signal_events (void);
+static void store_user_signal_events (void);
 
 /* These setters are used only in this file, so they can be private.  */
 static inline void
@@ -2010,7 +2010,7 @@ poll_for_input_1 (void)
 {
   if (interrupt_input_blocked == 0
       && !waiting_for_input)
-    read_avail_input (0);
+    read_avail_input ();
 }
 
 /* Timer callback function for poll_timer.  TIMER is equal to
@@ -3843,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp,
         interrupt handlers have not read it, read it now.  */
 
 #ifdef USABLE_SIGIO
-      gobble_input (0);
+      gobble_input ();
 #endif
       if (kbd_fetch_ptr != kbd_store_ptr)
        break;
@@ -3869,8 +3869,7 @@ kbd_buffer_get_event (KBOARD **kbp,
        wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
 
       if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
-       /* Pass 1 for EXPECT since we just waited to have input.  */
-       read_avail_input (1);
+       read_avail_input ();
     }
 
   if (CONSP (Vunread_command_events))
@@ -6734,14 +6733,14 @@ get_input_pending (int *addr, int flags)
     return;
 
   /* Try to read some input and see how much we get.  */
-  gobble_input (0);
+  gobble_input ();
   *addr = (!NILP (Vquit_flag) || readable_events (flags));
 }
 
 /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
 
 void
-gobble_input (int expected)
+gobble_input (void)
 {
 #ifdef USABLE_SIGIO
   if (interrupt_input)
@@ -6750,7 +6749,7 @@ gobble_input (int expected)
       sigemptyset (&blocked);
       sigaddset (&blocked, SIGIO);
       pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
-      read_avail_input (expected);
+      read_avail_input ();
       pthread_sigmask (SIG_SETMASK, &procmask, 0);
     }
   else
@@ -6764,13 +6763,13 @@ gobble_input (int expected)
       sigemptyset (&blocked);
       sigaddset (&blocked, SIGALRM);
       pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
-      read_avail_input (expected);
+      read_avail_input ();
       pthread_sigmask (SIG_SETMASK, &procmask, 0);
     }
   else
 #endif
 #endif
-    read_avail_input (expected);
+    read_avail_input ();
 }
 
 /* Put a BUFFER_SWITCH_EVENT in the buffer
@@ -6826,15 +6825,14 @@ record_asynch_buffer_change (void)
    this is a bad time to try to read input.  */
 
 static int
-read_avail_input (int expected)
+read_avail_input (void)
 {
   int nread = 0;
   int err = 0;
   struct terminal *t;
 
   /* Store pending user signal events, if any.  */
-  if (store_user_signal_events ())
-    expected = 0;
+  store_user_signal_events ();
 
   /* Loop through the available terminals, and call their input hooks.  */
   t = terminal_list;
@@ -6851,11 +6849,8 @@ read_avail_input (int expected)
           hold_quit.kind = NO_EVENT;
 
           /* No need for FIONREAD or fcntl; just say don't wait.  */
-          while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0)
-            {
-              nread += nr;
-              expected = 0;
-            }
+          while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
+           nread += nr;
 
           if (nr == -1)          /* Not OK to read input now.  */
             {
@@ -6950,7 +6945,6 @@ decode_keyboard_code (struct tty_display_info *tty,
 
 int
 tty_read_avail_input (struct terminal *terminal,
-                      int expected,
                       struct input_event *hold_quit)
 {
   /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
@@ -7170,8 +7164,7 @@ handle_async_input (void)
 
   while (1)
     {
-      int nread;
-      nread = read_avail_input (1);
+      int nread = read_avail_input ();
       /* -1 means it's not ok to read the input now.
         UNBLOCK_INPUT will read it later; now, avoid infinite loop.
         0 means there was no keyboard input available.  */
@@ -7323,25 +7316,25 @@ find_user_signal_name (int sig)
   return NULL;
 }
 
-static int
+static void
 store_user_signal_events (void)
 {
   struct user_signal_info *p;
   struct input_event buf;
-  int nstored = 0;
+  bool buf_initialized = 0;
 
   for (p = user_signals; p; p = p->next)
     if (p->npending > 0)
       {
        sigset_t blocked, procmask;
 
-       if (nstored == 0)
+       if (! buf_initialized)
          {
            memset (&buf, 0, sizeof buf);
            buf.kind = USER_SIGNAL_EVENT;
            buf.frame_or_window = selected_frame;
+           buf_initialized = 1;
          }
-       nstored += p->npending;
 
        sigemptyset (&blocked);
        sigaddset (&blocked, p->sig);
@@ -7357,8 +7350,6 @@ store_user_signal_events (void)
 
        pthread_sigmask (SIG_SETMASK, &procmask, 0);
       }
-
-  return nstored;
 }
 
 \f
index 91484b3649bdba0beaccbba86af3775ecd3f1ecd..3601f68be9fce8a5fc312a4bb0b14a4094a7ed28 100644 (file)
@@ -523,7 +523,7 @@ extern void input_poll_signal (int);
 extern void start_polling (void);
 extern void stop_polling (void);
 extern void set_poll_suppress_count (int);
-extern void gobble_input (int);
+extern void gobble_input (void);
 extern int input_polling_used (void);
 extern void clear_input_pending (void);
 extern int requeued_events_pending_p (void);
@@ -547,8 +547,7 @@ extern Lisp_Object menu_item_eval_property (Lisp_Object);
 extern int  kbd_buffer_events_waiting (int);
 extern void add_user_signal (int, const char *);
 
-extern int tty_read_avail_input (struct terminal *, int,
-                                 struct input_event *);
+extern int tty_read_avail_input (struct terminal *, struct input_event *);
 extern EMACS_TIME timer_check (void);
 extern void mark_kboards (void);
 
index 0b26508dbd0f5e562a4142c4f03447a2827f13a6..aa869e3ff44a401bb784b7cd9dd65ae28448c1e3 100644 (file)
@@ -3336,8 +3336,7 @@ ns_send_appdefined (int value)
 }
 
 static int
-ns_read_socket (struct terminal *terminal, int expected,
-                struct input_event *hold_quit)
+ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
 /* --------------------------------------------------------------------------
      External (hook): Post an event to ourself and keep reading events until
      we read it back again.  In effect process all events which were waiting.
@@ -4204,7 +4203,7 @@ ns_term_init (Lisp_Object display_name)
                             NSColorPboardType,
                             NSFontPboardType, nil] retain];
 
-  
+
   [NSApp run];
   ns_do_open_file = YES;
   return dpyinfo;
index 46962a1217de3acaaf6b3d7f202df62d9868252f..53e401de40945f1038b11d6e5341647bfb2c4aba 100644 (file)
@@ -592,23 +592,14 @@ struct terminal
 
      TERMINAL indicates which terminal device to read from.  Input
      events should be read into BUF, the size of which is given in
-     SIZE.  EXPECTED is non-zero if the caller suspects that new input
-     is available.
+     SIZE.
 
      A positive return value indicates that that many input events
-     where read into BUF.
+     were read into BUF.
      Zero means no events were immediately available.
      A value of -1 means a transient read error, while -2 indicates
-     that the device was closed (hangup), and it should be deleted.
-
-     XXX Please note that a non-zero value of EXPECTED only means that
-     there is available input on at least one of the currently opened
-     terminal devices -- but not necessarily on this device.
-     Therefore, in most cases EXPECTED should be simply ignored.
-
-     XXX This documentation needs to be updated.  */
+     that the device was closed (hangup), and it should be deleted.  */
   int (*read_socket_hook) (struct terminal *terminal,
-                           int expected,
                            struct input_event *hold_quit);
 
   /* Called when a frame's display becomes entirely up to date.  */
index d4cc620335cf58a5b1d8b04f0f042b07494587fe..a96d8d70483308a579897ee3a33da3cec834a246 100644 (file)
@@ -744,7 +744,6 @@ maybe_generate_resize_event (void)
 
 int
 w32_console_read_socket (struct terminal *terminal,
-                         int expected,
                          struct input_event *hold_quit)
 {
   int nev, add;
index c874e58ef3907571d0b4e343986faf378c3e39b0..319688b877bffc19e76cd565c9edaf4506b879d7 100644 (file)
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 extern int w32_console_unicode_input;
 
-extern int w32_console_read_socket (struct terminal *term, int numchars,
+extern int w32_console_read_socket (struct terminal *term,
                                    struct input_event *hold_quit);
 extern void w32_console_mouse_position (FRAME_PTR *f, int insist,
                                        Lisp_Object *bar_window,
index 6244728b264eb5a88ffb3710573b7c6096d39d59..b8227c52fed47cfdb847a660575898e88fe04cf2 100644 (file)
@@ -4137,8 +4137,6 @@ static char dbcs_lead = 0;
    We return the number of characters stored into the buffer,
    thus pretending to be `read'.
 
-   EXPECTED is nonzero if the caller knows input is available.
-
    Some of these messages are reposted back to the message queue since the
    system calls the windows proc directly in a context where we cannot return
    the data nor can we guarantee the state we are in.  So if we dispatch them
@@ -4149,7 +4147,7 @@ static char dbcs_lead = 0;
 */
 
 static int
-w32_read_socket (struct terminal *terminal, int expected,
+w32_read_socket (struct terminal *terminal,
                 struct input_event *hold_quit)
 {
   int count = 0;
index 9ab53dc087a3edc8a24a3c36d58c5727ff4ce9c2..8c955d0e5769408be7e7304e5280349821c53f03 100644 (file)
@@ -7109,19 +7109,15 @@ x_dispatch_event (XEvent *event, Display *display)
 
 
 /* Read events coming from the X server.
-   This routine is called by the SIGIO handler only if SYNC_INPUT is
-   not defined.
-   We return as soon as there are no more events to be read.
+   Return as soon as there are no more events to be read.
 
-   We return the number of characters stored into the buffer,
+   Return the number of characters stored into the buffer,
    thus pretending to be `read' (except the characters we store
    in the keyboard buffer can be multibyte, so are not necessarily
-   C chars).
-
-   EXPECTED is nonzero if the caller knows input is available.  */
+   C chars).  */
 
 static int
-XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit)
+XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
 {
   int count = 0;
   int event_found = 0;