emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114033: Simplify SELECT_TYPE-related code.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r114033: Simplify SELECT_TYPE-related code.
Date: Tue, 27 Aug 2013 19:36:32 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114033
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-08-27 12:36:28 -0700
message:
  Simplify SELECT_TYPE-related code.
  
  Like EMACS_TIME, this portability layer is no longer needed, since
  Emacs has been using fd_set as a portability layer for some time.
  * sysselect.h (FD_SETSIZE): Rename from MAXDESC.  All uses changed.
  (SELECT_TYPE): Remove.  All uses changed to fd_set.
  (fd_set) [!FD_SET]: New typedef.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
  src/process.c                  process.c-20091113204419-o5vbwnq5f7feedwu-462
  src/sysdep.c                   sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
  src/sysselect.h                sysselect.h-20091113204419-o5vbwnq5f7feedwu-826
  src/xgselect.c                 xgselect.c-20091121171556-bypaf8oo9ygoo13w-2
  src/xgselect.h                 xgselect.h-20091121171556-bypaf8oo9ygoo13w-3
  src/xmenu.c                    xmenu.c-20091113204419-o5vbwnq5f7feedwu-161
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-27 18:47:55 +0000
+++ b/src/ChangeLog     2013-08-27 19:36:28 +0000
@@ -1,5 +1,12 @@
 2013-08-27  Paul Eggert  <address@hidden>
 
+       Simplify SELECT_TYPE-related code.
+       Like EMACS_TIME, this portability layer is no longer needed, since
+       Emacs has been using fd_set as a portability layer for some time.
+       * sysselect.h (FD_SETSIZE): Rename from MAXDESC.  All uses changed.
+       (SELECT_TYPE): Remove.  All uses changed to fd_set.
+       (fd_set) [!FD_SET]: New typedef.
+
        Simplify EMACS_TIME-related code.
        This portability layer is no longer needed, since Emacs has been
        using struct timespec as a portability layer for some time.

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2013-08-27 18:47:55 +0000
+++ b/src/nsterm.m      2013-08-27 19:36:28 +0000
@@ -4686,7 +4686,7 @@
   int waiting = 1, nfds;
   char c;
 
-  SELECT_TYPE readfds, writefds, *wfds;
+  fd_set readfds, writefds, *wfds;
   struct timespec timeout, *tmo;
   NSAutoreleasePool *pool = nil;
 
@@ -4699,7 +4699,7 @@
 
       if (waiting)
         {
-          SELECT_TYPE fds;
+          fd_set fds;
           FD_ZERO (&fds);
           FD_SET (selfds[0], &fds);
           result = select (selfds[0]+1, &fds, NULL, NULL, NULL);

=== modified file 'src/process.c'
--- a/src/process.c     2013-08-27 18:47:55 +0000
+++ b/src/process.c     2013-08-27 19:36:28 +0000
@@ -132,7 +132,7 @@
 #endif
 
 #ifdef WINDOWSNT
-extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
+extern int sys_select (int, fd_set *, fd_set *, fd_set *,
                       struct timespec *, void *);
 #endif
 
@@ -280,7 +280,7 @@
 
 static void create_process (Lisp_Object, char **, Lisp_Object);
 #ifdef USABLE_SIGIO
-static bool keyboard_bit_set (SELECT_TYPE *);
+static bool keyboard_bit_set (fd_set *);
 #endif
 static void deactivate_process (Lisp_Object);
 static void status_notify (struct Lisp_Process *);
@@ -299,26 +299,26 @@
 
 /* Mask of bits indicating the descriptors that we wait for input on.  */
 
-static SELECT_TYPE input_wait_mask;
+static fd_set input_wait_mask;
 
 /* Mask that excludes keyboard input descriptor(s).  */
 
-static SELECT_TYPE non_keyboard_wait_mask;
+static fd_set non_keyboard_wait_mask;
 
 /* Mask that excludes process input descriptor(s).  */
 
-static SELECT_TYPE non_process_wait_mask;
+static fd_set non_process_wait_mask;
 
 /* Mask for selecting for write.  */
 
-static SELECT_TYPE write_mask;
+static fd_set write_mask;
 
 #ifdef NON_BLOCKING_CONNECT
 /* Mask of bits indicating the descriptors that we wait for connect to
    complete on.  Once they complete, they are removed from this mask
    and added to the input_wait_mask and non_keyboard_wait_mask.  */
 
-static SELECT_TYPE connect_wait_mask;
+static fd_set connect_wait_mask;
 
 /* Number of bits set in connect_wait_mask.  */
 static int num_pending_connects;
@@ -331,7 +331,7 @@
 static int max_input_desc;
 
 /* Indexed by descriptor, gives the process (if any) for that descriptor */
-static Lisp_Object chan_process[MAXDESC];
+static Lisp_Object chan_process[FD_SETSIZE];
 
 /* Alist of elements (NAME . PROCESS) */
 static Lisp_Object Vprocess_alist;
@@ -342,18 +342,18 @@
    output from the process is to read at least one char.
    Always -1 on systems that support FIONREAD.  */
 
-static int proc_buffered_char[MAXDESC];
+static int proc_buffered_char[FD_SETSIZE];
 
 /* Table of `struct coding-system' for each process.  */
-static struct coding_system *proc_decode_coding_system[MAXDESC];
-static struct coding_system *proc_encode_coding_system[MAXDESC];
+static struct coding_system *proc_decode_coding_system[FD_SETSIZE];
+static struct coding_system *proc_encode_coding_system[FD_SETSIZE];
 
 #ifdef DATAGRAM_SOCKETS
 /* Table of `partner address' for datagram sockets.  */
 static struct sockaddr_and_len {
   struct sockaddr *sa;
   int len;
-} datagram_address[MAXDESC];
+} datagram_address[FD_SETSIZE];
 #define DATAGRAM_CHAN_P(chan)  (datagram_address[chan].sa != 0)
 #define DATAGRAM_CONN_P(proc)  (PROCESSP (proc) && datagram_address[XPROCESS 
(proc)->infd].sa != 0)
 #else
@@ -458,7 +458,7 @@
 #define FOR_READ  1
 #define FOR_WRITE 2
   int condition; /* mask of the defines above.  */
-} fd_callback_info[MAXDESC];
+} fd_callback_info[FD_SETSIZE];
 
 
 /* Add a file descriptor FD to be monitored for when read is possible.
@@ -467,7 +467,7 @@
 void
 add_read_fd (int fd, fd_callback func, void *data)
 {
-  eassert (fd < MAXDESC);
+  eassert (fd < FD_SETSIZE);
   add_keyboard_wait_descriptor (fd);
 
   fd_callback_info[fd].func = func;
@@ -480,7 +480,7 @@
 void
 delete_read_fd (int fd)
 {
-  eassert (fd < MAXDESC);
+  eassert (fd < FD_SETSIZE);
   delete_keyboard_wait_descriptor (fd);
 
   fd_callback_info[fd].condition &= ~FOR_READ;
@@ -497,7 +497,7 @@
 void
 add_write_fd (int fd, fd_callback func, void *data)
 {
-  eassert (fd < MAXDESC);
+  eassert (fd < FD_SETSIZE);
   FD_SET (fd, &write_mask);
   if (fd > max_input_desc)
     max_input_desc = fd;
@@ -528,7 +528,7 @@
 void
 delete_write_fd (int fd)
 {
-  eassert (fd < MAXDESC);
+  eassert (fd < FD_SETSIZE);
   FD_CLR (fd, &write_mask);
   fd_callback_info[fd].condition &= ~FOR_WRITE;
   if (fd_callback_info[fd].condition == 0)
@@ -3232,7 +3232,7 @@
             wait for completion is pselect(). */
          int sc;
          socklen_t len;
-         SELECT_TYPE fdset;
+         fd_set fdset;
        retry_select:
          FD_ZERO (&fdset);
          FD_SET (s, &fdset);
@@ -4232,8 +4232,8 @@
                             struct Lisp_Process *wait_proc, int just_wait_proc)
 {
   int channel, nfds;
-  SELECT_TYPE Available;
-  SELECT_TYPE Writeok;
+  fd_set Available;
+  fd_set Writeok;
   bool check_write;
   int check_delay;
   bool no_avail;
@@ -4387,8 +4387,8 @@
         timeout to get our attention.  */
       if (update_tick != process_tick)
        {
-         SELECT_TYPE Atemp;
-         SELECT_TYPE Ctemp;
+         fd_set Atemp;
+         fd_set Ctemp;
 
           if (kbd_on_hold_p ())
             FD_ZERO (&Atemp);
@@ -4571,7 +4571,7 @@
                     the gnutls library -- 2.12.14 has been confirmed
                     to need it.  See
                     http://comments.gmane.org/gmane.emacs.devel/145074 */
-                 for (channel = 0; channel < MAXDESC; ++channel)
+                 for (channel = 0; channel < FD_SETSIZE; ++channel)
                    if (! NILP (chan_process[channel]))
                      {
                        struct Lisp_Process *p =
@@ -6542,7 +6542,7 @@
 #else  /* not subprocesses */
 
 /* Defined on msdos.c.  */
-extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
+extern int sys_select (int, fd_set *, fd_set *, fd_set *,
                       struct timespec *, void *);
 
 /* Implementation of wait_reading_process_output, assuming that there
@@ -6608,7 +6608,7 @@
   while (1)
     {
       bool timeout_reduced_for_timers = 0;
-      SELECT_TYPE waitchannels;
+      fd_set waitchannels;
       int xerrno;
 
       /* If calling from keyboard input, do not quit
@@ -7072,7 +7072,7 @@
 
   Vprocess_alist = Qnil;
   deleted_pid_list = Qnil;
-  for (i = 0; i < MAXDESC; i++)
+  for (i = 0; i < FD_SETSIZE; i++)
     {
       chan_process[i] = Qnil;
       proc_buffered_char[i] = -1;

=== modified file 'src/sysdep.c'
--- a/src/sysdep.c      2013-08-27 18:47:55 +0000
+++ b/src/sysdep.c      2013-08-27 19:36:28 +0000
@@ -588,7 +588,7 @@
 }
 
 #ifdef USABLE_SIGIO
-static int old_fcntl_flags[MAXDESC];
+static int old_fcntl_flags[FD_SETSIZE];
 #endif
 
 void
@@ -817,7 +817,7 @@
 
 
 #ifdef F_SETOWN
-static int old_fcntl_owner[MAXDESC];
+static int old_fcntl_owner[FD_SETSIZE];
 #endif /* F_SETOWN */
 
 /* This may also be defined in stdio,

=== modified file 'src/sysselect.h'
--- a/src/sysselect.h   2013-01-01 09:11:05 +0000
+++ b/src/sysselect.h   2013-08-27 19:36:28 +0000
@@ -25,15 +25,12 @@
    definitions in w32.h are incompatible with the below.  */
 #ifndef WINDOWSNT
 #ifdef FD_SET
-#ifdef FD_SETSIZE
-#define MAXDESC FD_SETSIZE
-#else
-#define MAXDESC 64
+#ifndef FD_SETSIZE
+#define FD_SETSIZE 64
 #endif
-#define SELECT_TYPE fd_set
 #else /* no FD_SET */
-#define MAXDESC 32
-#define SELECT_TYPE int
+#define FD_SETSIZE 32
+typedef int fd_set;
 
 /* Define the macros to access a single-int bitmap of descriptors.  */
 #define FD_SET(n, p) (*(p) |= (1 << (n)))

=== modified file 'src/xgselect.c'
--- a/src/xgselect.c    2013-08-27 18:47:55 +0000
+++ b/src/xgselect.c    2013-08-27 19:36:28 +0000
@@ -29,10 +29,10 @@
 #include "frame.h"
 
 int
-xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE 
*efds,
+xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
           struct timespec const *timeout, sigset_t const *sigmask)
 {
-  SELECT_TYPE all_rfds, all_wfds;
+  fd_set all_rfds, all_wfds;
   struct timespec tmo;
   struct timespec const *tmop = timeout;
 

=== modified file 'src/xgselect.h'
--- a/src/xgselect.h    2013-08-27 18:47:55 +0000
+++ b/src/xgselect.h    2013-08-27 19:36:28 +0000
@@ -25,9 +25,7 @@
 #include "sysselect.h"
 
 extern int xg_select (int max_fds,
-                      SELECT_TYPE *rfds,
-                      SELECT_TYPE *wfds,
-                      SELECT_TYPE *efds,
+                     fd_set *rfds, fd_set *wfds, fd_set *efds,
                      struct timespec const *timeout,
                      sigset_t const *sigmask);
 

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2013-08-27 18:47:55 +0000
+++ b/src/xmenu.c       2013-08-27 19:36:28 +0000
@@ -378,7 +378,7 @@
          )
     {
       struct timespec next_time = timer_check (), *ntp;
-      SELECT_TYPE read_fds;
+      fd_set read_fds;
       struct x_display_info *dpyinfo;
       int n = 0;
 

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-08-27 18:47:55 +0000
+++ b/src/xterm.c       2013-08-27 19:36:28 +0000
@@ -8676,7 +8676,7 @@
 {
   int level = interrupt_input_blocked;
 
-  SELECT_TYPE fds;
+  fd_set fds;
   struct timespec tmo, tmo_at, time_now;
   int fd = ConnectionNumber (FRAME_X_DISPLAY (f));
 


reply via email to

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