From 97107e2e531ee355f517990eed735fa657b7105b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 May 2012 22:27:24 -0700 Subject: [PATCH] * xgselect.c (xg_select): Put maxfds+1 into a var. This is slightly clearer, and pacifies Ubuntu 12.04 gcc. --- src/ChangeLog | 3 +++ src/xgselect.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f5b18b8d13a..84764cfc5fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-05-10 Paul Eggert + * xgselect.c (xg_select): Put maxfds+1 into a var. + This is slightly clearer, and pacifies Ubuntu 12.04 gcc. + * sound.c (DEFAULT_ALSA_SOUND_DEVICE): Define only if HAVE_ALSA. 2012-05-10 Dave Abrahams diff --git a/src/xgselect.c b/src/xgselect.c index 80dbfc32aee..7a09c37c50d 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -41,7 +41,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, GMainContext *context = g_main_context_default (); int have_wfds = wfds != NULL; int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0; - int i, nfds, tmo_in_millisec; + int i, nfds, fds_lim, tmo_in_millisec; if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds)); else FD_ZERO (&all_rfds); @@ -97,14 +97,14 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, if (our_tmo) tmop = &tmo; } - nfds = select (max_fds+1, &all_rfds, have_wfds ? &all_wfds : NULL, - efds, tmop); + fds_lim = max_fds + 1; + nfds = select (fds_lim, &all_rfds, have_wfds ? &all_wfds : NULL, efds, tmop); if (nfds < 0) retval = nfds; else if (nfds > 0) { - for (i = 0; i < max_fds+1; ++i) + for (i = 0; i < fds_lim; ++i) { if (FD_ISSET (i, &all_rfds)) { -- 2.11.4.GIT