[PATCH] event-loop: remove dead code
Kristian Høgsberg
hoegsberg at gmail.com
Mon Sep 10 18:28:22 PDT 2012
On Sat, Sep 08, 2012 at 05:47:15PM +0200, David Herrmann wrote:
> 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.
Yea, let's get rid of that. It goes back to
3c5d9694db6f8bcbebc9a8d1ae3afd8e61530089. Ander fixed a bug where
we'd miss the post_dispatch_check() in case of processing one or more
idle sources and no epoll events.
thanks,
Kristian
>
> 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