diff mbox

[v1,3/3] util/oslib-win32: Remove if conditional

Message ID a14083d681951f3999a0e9314605cb706381ae8d.1498756113.git.alistair.francis@xilinx.com
State New
Headers show

Commit Message

Alistair Francis June 29, 2017, 5:16 p.m. UTC
The original ready < nhandles - 1 can be re-written as ready + 1 <
nhandles which is the same confition that we are checking on the first
itteration of the for loop. This means we can remove the if statement
and let the for loop check the code.

This also has the side effect of removing an invalid check as
WAIT_OBJECT_0 was not subtracted from ready.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---

 util/oslib-win32.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 7ec0f8e083..d42d695050 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -438,10 +438,8 @@  static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,
         if (timeout == 0 && nhandles > 1) {
             /* Remove the handle that fired */
             int i;
-            if (ready < nhandles - 1) {
-                for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++) {
-                    handles[i-1] = handles[i];
-                }
+            for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++) {
+                handles[i-1] = handles[i];
             }
             nhandles--;
             recursed_result = poll_rest(FALSE, handles, nhandles, fds, nfds, 0);