[PATCH] event-loop: remove dead code

David Herrmann dh.herrmann at googlemail.com
Sat Sep 8 08:47:15 PDT 2012


There is really no need to increment "n" if we never read the value. The
do-while() loop overwrites the value before it is read the first time.

Signed-off-by: David Herrmann <dh.herrmann at googlemail.com>
---
I am not sure what the intention is here. Either we want a normal "while()" loop
below and only do the post-dispatch if the real dispatch returned >0. Or, this
is just dead code and we can remove it.
I assumed the latter is true so this patch simply removes what has no effect.

 src/event-loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/event-loop.c b/src/event-loop.c
index a839daf..df4b8b8 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -403,11 +403,11 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout)
 	count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
 	if (count < 0)
 		return -1;
-	n = 0;
+
 	for (i = 0; i < count; i++) {
 		source = ep[i].data.ptr;
 		if (source->fd != -1)
-			n += source->interface->dispatch(source, &ep[i]);
+			source->interface->dispatch(source, &ep[i]);
 	}
 
 	wl_event_loop_process_destroy_list(loop);
-- 
1.7.12



More information about the wayland-devel mailing list