Refill some long/short copyright headers.
[bpt/emacs.git] / src / xgselect.c
index d93c1bd..359a8fb 100644 (file)
@@ -1,6 +1,6 @@
 /* Function for handling the GLib event loop.
-   Copyright (C) 2009, 2010
-     Free Software Foundation, Inc.
+
+Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,7 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+#include <config.h>
 
 #if defined (USE_GTK) || defined (HAVE_GCONF)
 #include <glib.h>
@@ -29,12 +29,8 @@ static GPollFD *gfds;
 static int gfds_size;
 
 int
-xg_select (max_fds, rfds, wfds, efds, timeout)
-     int max_fds;
-     SELECT_TYPE *rfds;
-     SELECT_TYPE *wfds;
-     SELECT_TYPE *efds;
-     EMACS_TIME *timeout;
+xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+          EMACS_TIME *timeout)
 {
   SELECT_TYPE all_rfds, all_wfds;
   EMACS_TIME tmo, *tmop = timeout;
@@ -113,11 +109,17 @@ xg_select (max_fds, rfds, wfds, efds, timeout)
               if (rfds && FD_ISSET (i, rfds)) ++retval;
               else ++our_fds;
             }
+          else if (rfds)
+            FD_CLR (i, rfds);
+
           if (have_wfds && FD_ISSET (i, &all_wfds))
             {
               if (wfds && FD_ISSET (i, wfds)) ++retval;
               else ++our_fds;
             }
+          else if (wfds)
+            FD_CLR (i, wfds);
+
           if (efds && FD_ISSET (i, efds))
             ++retval;
         }
@@ -147,7 +149,7 @@ xg_select (max_fds, rfds, wfds, efds, timeout)
 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
 
 void
-xgselect_initialize ()
+xgselect_initialize (void)
 {
 #if defined (USE_GTK) || defined (HAVE_GCONF)
   gfds_size = 128;
@@ -155,5 +157,3 @@ xgselect_initialize ()
 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
 }
 
-/* arch-tag: c5873ee3-d1f6-44f9-9f3b-b14f70fd0e6a
-   (do not change this comment) */