client: Simply wl_display_dispatch_queue_pending() and fix return value
authorJiergir Ogoerg <f35f22fan@gmail.com>
Mon, 29 Jul 2013 23:50:44 +0000 (16:50 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 29 Jul 2013 23:50:44 +0000 (16:50 -0700)
We're supposed to return number of events dispatched on success, not 0.
Refactor to avoid goto and just return ret.

src/wayland-client.c

index 2887a40..532d379 100644 (file)
@@ -1157,18 +1157,15 @@ WL_EXPORT int
 wl_display_dispatch_queue_pending(struct wl_display *display,
                                  struct wl_event_queue *queue)
 {
+       int ret;
+
        pthread_mutex_lock(&display->mutex);
 
-       if (dispatch_queue(display, queue) == -1)
-               goto err_unlock;
+       ret = dispatch_queue(display, queue);
 
        pthread_mutex_unlock(&display->mutex);
 
-       return 0;
-
- err_unlock:
-       pthread_mutex_unlock(&display->mutex);
-       return -1;
+       return ret;
 }
 
 /** Process incoming events