emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110106: Omit unused arg EXPECTED fro


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110106: Omit unused arg EXPECTED from socket hooks.
Date: Wed, 19 Sep 2012 18:37:07 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110106
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2012-09-19 18:37:07 -0700
message:
  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.
modified:
  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
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-20 01:02:21 +0000
+++ b/src/ChangeLog     2012-09-20 01:37:07 +0000
@@ -1,3 +1,16 @@
+2012-09-20  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * w32gui.h (XParseGeometry): Do not declare.

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2012-09-15 07:06:56 +0000
+++ b/src/dispnew.c     2012-09-20 01:37:07 +0000
@@ -5971,7 +5971,7 @@
 
 
 #ifdef USABLE_SIGIO
-  gobble_input (0);
+  gobble_input ();
 #endif
 
   wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display,

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-09-16 21:43:55 +0000
+++ b/src/keyboard.c    2012-09-20 01:37:07 +0000
@@ -413,7 +413,7 @@
 /* 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_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 @@
 {
   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 @@
         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 @@
        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 @@
     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 @@
       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 @@
       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 @@
    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 @@
           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 @@
 
 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 @@
 
   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 @@
   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 @@
 
        pthread_sigmask (SIG_SETMASK, &procmask, 0);
       }
-
-  return nstored;
 }
 
 

=== modified file 'src/keyboard.h'
--- a/src/keyboard.h    2012-09-02 16:56:31 +0000
+++ b/src/keyboard.h    2012-09-20 01:37:07 +0000
@@ -523,7 +523,7 @@
 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 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);
 

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2012-09-16 21:43:55 +0000
+++ b/src/nsterm.m      2012-09-20 01:37:07 +0000
@@ -3336,8 +3336,7 @@
 }
 
 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 @@
                             NSColorPboardType,
                             NSFontPboardType, nil] retain];
 
-  
+
   [NSApp run];
   ns_do_open_file = YES;
   return dpyinfo;

=== modified file 'src/termhooks.h'
--- a/src/termhooks.h   2012-08-18 00:07:52 +0000
+++ b/src/termhooks.h   2012-09-20 01:37:07 +0000
@@ -592,23 +592,14 @@
 
      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.  */

=== modified file 'src/w32inevt.c'
--- a/src/w32inevt.c    2012-09-19 21:38:00 +0000
+++ b/src/w32inevt.c    2012-09-20 01:37:07 +0000
@@ -744,7 +744,6 @@
 
 int
 w32_console_read_socket (struct terminal *terminal,
-                         int expected,
                          struct input_event *hold_quit)
 {
   int nev, add;

=== modified file 'src/w32inevt.h'
--- a/src/w32inevt.h    2012-07-29 08:18:29 +0000
+++ b/src/w32inevt.h    2012-09-20 01:37:07 +0000
@@ -21,7 +21,7 @@
 
 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,

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2012-09-17 07:56:20 +0000
+++ b/src/w32term.c     2012-09-20 01:37:07 +0000
@@ -4137,8 +4137,6 @@
    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 int
-w32_read_socket (struct terminal *terminal, int expected,
+w32_read_socket (struct terminal *terminal,
                 struct input_event *hold_quit)
 {
   int count = 0;

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2012-09-16 21:43:55 +0000
+++ b/src/xterm.c       2012-09-20 01:37:07 +0000
@@ -7109,19 +7109,15 @@
 
 
 /* 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;


reply via email to

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