diff options
| author | Kristian Høgsberg <krh@bitplanet.net> | 2010-02-26 10:28:44 -0500 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2010-02-26 10:28:44 -0500 |
| commit | a5db589efaedebf2b01a61baa2efc917a7e45d68 (patch) | |
| tree | 37ff5c71534b0673bf4ce57c7d382c63f2ce3a6d /wayland.c | |
| parent | d923e9d93b95e1c902dade030ae5af2e80242878 (diff) | |
| download | wayland-a5db589efaedebf2b01a61baa2efc917a7e45d68.tar.gz wayland-a5db589efaedebf2b01a61baa2efc917a7e45d68.tar.xz wayland-a5db589efaedebf2b01a61baa2efc917a7e45d68.zip | |
Add wl_list_for_each() and simplify some loops
Diffstat (limited to 'wayland.c')
| -rw-r--r-- | wayland.c | 22 |
1 files changed, 3 insertions, 19 deletions
@@ -186,26 +186,16 @@ wl_client_create(struct wl_display *display, int fd) wl_display_post_range(display, client); - global = container_of(display->global_list.next, - struct wl_global, link); - while (&global->link != &display->global_list) { + wl_list_for_each(global, &display->global_list, link) wl_client_post_event(client, &client->display->base, WL_DISPLAY_GLOBAL, global->object, global->object->interface->name, global->object->interface->version); - global = container_of(global->link.next, - struct wl_global, link); - } - global = container_of(display->global_list.next, - struct wl_global, link); - while (&global->link != &display->global_list) { + wl_list_for_each(global, &display->global_list, link) if (global->func) global->func(client, global->object); - global = container_of(global->link.next, - struct wl_global, link); - } return client; } @@ -384,15 +374,9 @@ wl_display_post_frame(struct wl_display *display, { struct wl_client *client; - client = container_of(display->pending_frame_list.next, - struct wl_client, link); - - while (&client->link != &display->pending_frame_list) { + wl_list_for_each(client, &display->pending_frame_list, link) wl_client_post_event(client, &compositor->base, WL_COMPOSITOR_FRAME, frame, msecs); - client = container_of(client->link.next, - struct wl_client, link); - } wl_list_remove(&display->pending_frame_list); wl_list_init(&display->pending_frame_list); |
