mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
Use wl_container_of internally
Rather than have two versions of the macro with slightly different interfaces, just use wl_container_of internally. This also removes use of statement expressions, a GNU C extension. Signed-off-by: Michael Forney <mforney@mforney.org>
This commit is contained in:
parent
2485a5c274
commit
55d044810c
7 changed files with 11 additions and 14 deletions
|
|
@ -595,8 +595,8 @@ wl_event_loop_dispatch_idle(struct wl_event_loop *loop)
|
||||||
struct wl_event_source_idle *source;
|
struct wl_event_source_idle *source;
|
||||||
|
|
||||||
while (!wl_list_empty(&loop->idle_list)) {
|
while (!wl_list_empty(&loop->idle_list)) {
|
||||||
source = container_of(loop->idle_list.next,
|
source = wl_container_of(loop->idle_list.next,
|
||||||
struct wl_event_source_idle, base.link);
|
source, base.link);
|
||||||
source->func(source->base.data);
|
source->func(source->base.data);
|
||||||
wl_event_source_remove(&source->base);
|
wl_event_source_remove(&source->base);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -298,8 +298,8 @@ wl_event_queue_release(struct wl_event_queue *queue)
|
||||||
struct wl_closure *closure;
|
struct wl_closure *closure;
|
||||||
|
|
||||||
while (!wl_list_empty(&queue->event_list)) {
|
while (!wl_list_empty(&queue->event_list)) {
|
||||||
closure = container_of(queue->event_list.next,
|
closure = wl_container_of(queue->event_list.next,
|
||||||
struct wl_closure, link);
|
closure, link);
|
||||||
wl_list_remove(&closure->link);
|
wl_list_remove(&closure->link);
|
||||||
destroy_queued_closure(closure);
|
destroy_queued_closure(closure);
|
||||||
}
|
}
|
||||||
|
|
@ -1400,8 +1400,7 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
|
||||||
int opcode;
|
int opcode;
|
||||||
bool proxy_destroyed;
|
bool proxy_destroyed;
|
||||||
|
|
||||||
closure = container_of(queue->event_list.next,
|
closure = wl_container_of(queue->event_list.next, closure, link);
|
||||||
struct wl_closure, link);
|
|
||||||
wl_list_remove(&closure->link);
|
wl_list_remove(&closure->link);
|
||||||
opcode = closure->opcode;
|
opcode = closure->opcode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,6 @@
|
||||||
|
|
||||||
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
|
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
|
||||||
|
|
||||||
#define container_of(ptr, type, member) ({ \
|
|
||||||
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
|
|
||||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
|
||||||
|
|
||||||
#define WL_MAP_SERVER_SIDE 0
|
#define WL_MAP_SERVER_SIDE 0
|
||||||
#define WL_MAP_CLIENT_SIDE 1
|
#define WL_MAP_CLIENT_SIDE 1
|
||||||
#define WL_SERVER_ID_START 0xff000000
|
#define WL_SERVER_ID_START 0xff000000
|
||||||
|
|
|
||||||
|
|
@ -1899,7 +1899,9 @@ wl_client_get_link(struct wl_client *client)
|
||||||
WL_EXPORT struct wl_client *
|
WL_EXPORT struct wl_client *
|
||||||
wl_client_from_link(struct wl_list *link)
|
wl_client_from_link(struct wl_list *link)
|
||||||
{
|
{
|
||||||
return container_of(link, struct wl_client, link);
|
struct wl_client *client;
|
||||||
|
|
||||||
|
return wl_container_of(link, client, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a listener for the client's resource creation signal
|
/** Add a listener for the client's resource creation signal
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static void
|
||||||
client_destroy_notify(struct wl_listener *l, void *data)
|
client_destroy_notify(struct wl_listener *l, void *data)
|
||||||
{
|
{
|
||||||
struct client_destroy_listener *listener =
|
struct client_destroy_listener *listener =
|
||||||
container_of(l, struct client_destroy_listener, listener);
|
wl_container_of(l, listener, listener);
|
||||||
|
|
||||||
listener->done = 1;
|
listener->done = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ display_destroy_notify(struct wl_listener *l, void *data)
|
||||||
{
|
{
|
||||||
struct display_destroy_listener *listener;
|
struct display_destroy_listener *listener;
|
||||||
|
|
||||||
listener = container_of(l, struct display_destroy_listener, listener);
|
listener = wl_container_of(l, listener, listener);
|
||||||
listener->done = 1;
|
listener->done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ static void
|
||||||
event_loop_destroy_notify(struct wl_listener *l, void *data)
|
event_loop_destroy_notify(struct wl_listener *l, void *data)
|
||||||
{
|
{
|
||||||
struct event_loop_destroy_listener *listener =
|
struct event_loop_destroy_listener *listener =
|
||||||
container_of(l, struct event_loop_destroy_listener, listener);
|
wl_container_of(l, listener, listener);
|
||||||
|
|
||||||
listener->done = 1;
|
listener->done = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue