aboutsummaryrefslogtreecommitdiffstats
path: root/src/xgselect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xgselect.c')
-rw-r--r--src/xgselect.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/xgselect.c b/src/xgselect.c
index 9ccdd37489f..80dbfc32aee 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -1,6 +1,6 @@
1/* Function for handling the GLib event loop. 1/* Function for handling the GLib event loop.
2 2
3Copyright (C) 2009-2011 Free Software Foundation, Inc. 3Copyright (C) 2009-2012 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <http§://www.gnu.org/licenses/>. */
29#include <setjmp.h> 29#include <setjmp.h>
30 30
31static GPollFD *gfds; 31static GPollFD *gfds;
32static int gfds_size; 32static ptrdiff_t gfds_size;
33 33
34int 34int
35xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, 35xg_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,
54 do { 54 do {
55 if (n_gfds > gfds_size) 55 if (n_gfds > gfds_size)
56 { 56 {
57 while (n_gfds > gfds_size)
58 gfds_size *= 2;
59 xfree (gfds); 57 xfree (gfds);
60 gfds = xmalloc (sizeof (*gfds) * gfds_size); 58 gfds = xpalloc (0, &gfds_size, n_gfds - gfds_size, INT_MAX,
59 sizeof *gfds);
61 } 60 }
62 61
63 n_gfds = g_main_context_query (context, 62 n_gfds = g_main_context_query (context,