]> code.delx.au - gnu-emacs/blobdiff - src/xgselect.c
* window.c (Fdelete_window_internal): Invalidate the mouse highlight.
[gnu-emacs] / src / xgselect.c
index 0d154f6496ad8e56c08a2f8cc59724cbbd60f618..80dbfc32aee86726337115c686e4dcb1664bf1bd 100644 (file)
@@ -1,6 +1,6 @@
 /* Function for handling the GLib event loop.
 
-Copyright (C) 2009-2011  Free Software Foundation, Inc.
+Copyright (C) 2009-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,21 +15,21 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 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/>.  */
+along with GNU Emacs.  If not, see <httpยง://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
 #include <setjmp.h>
 #include "xgselect.h"
 
-#if defined (USE_GTK) || defined (HAVE_GCONF)
+#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
 
 #include <glib.h>
 #include <errno.h>
 #include <setjmp.h>
 
 static GPollFD *gfds;
-static int gfds_size;
+static ptrdiff_t gfds_size;
 
 int
 xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
@@ -54,10 +54,9 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
   do {
     if (n_gfds > gfds_size)
       {
-        while (n_gfds > gfds_size)
-          gfds_size *= 2;
         xfree (gfds);
-        gfds = xmalloc (sizeof (*gfds) * gfds_size);
+       gfds = xpalloc (0, &gfds_size, n_gfds - gfds_size, INT_MAX,
+                       sizeof *gfds);
       }
 
     n_gfds = g_main_context_query (context,
@@ -149,13 +148,13 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
 
   return retval;
 }
-#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
+#endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */
 
 void
 xgselect_initialize (void)
 {
-#if defined (USE_GTK) || defined (HAVE_GCONF)
+#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
   gfds_size = 128;
   gfds = xmalloc (sizeof (*gfds)*gfds_size);
-#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
+#endif
 }