diff options
-rw-r--r-- | cursor/wayland-cursor.c | 2 | ||||
-rw-r--r-- | src/event-loop.c | 1 | ||||
-rw-r--r-- | src/scanner.c | 20 | ||||
-rw-r--r-- | src/wayland-private.h | 2 | ||||
-rw-r--r-- | src/wayland-util.h | 2 |
5 files changed, 21 insertions, 6 deletions
diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c index 0d1fec7..25e51c2 100644 --- a/cursor/wayland-cursor.c +++ b/cursor/wayland-cursor.c @@ -31,6 +31,8 @@ #include "os-compatibility.h" +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) + struct shm_pool { struct wl_shm_pool *pool; int fd; diff --git a/src/event-loop.c b/src/event-loop.c index e383300..8db9c7c 100644 --- a/src/event-loop.c +++ b/src/event-loop.c @@ -35,6 +35,7 @@ #include <unistd.h> #include <assert.h> #include "wayland-server.h" +#include "wayland-private.h" #include "wayland-os.h" struct wl_event_loop { diff --git a/src/scanner.c b/src/scanner.c index 47c22cb..d0aafec 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -127,6 +127,18 @@ struct parse_context { unsigned int character_data_length; }; +static int +list_length(struct wl_list *list) +{ + struct wl_list *l; + int i; + + for (i = 0, l = list->next; l != list; i++, l = l->next) + ; + + return i; +} + static char * uppercase_dup(const char *src) { @@ -1106,14 +1118,14 @@ emit_code(struct protocol *protocol) i->name, i->name, i->version); if (!wl_list_empty(&i->request_list)) - printf("\tARRAY_LENGTH(%s_requests), %s_requests,\n", - i->name, i->name); + printf("\t%d, %s_requests,\n", + list_length(&i->request_list), i->name); else printf("\t0, NULL,\n"); if (!wl_list_empty(&i->event_list)) - printf("\tARRAY_LENGTH(%s_events), %s_events,\n", - i->name, i->name); + printf("\t%d, %s_events,\n", + list_length(&i->event_list), i->name); else printf("\t0, NULL,\n"); diff --git a/src/wayland-private.h b/src/wayland-private.h index 8adee9f..0d617a7 100644 --- a/src/wayland-private.h +++ b/src/wayland-private.h @@ -28,6 +28,8 @@ #include <ffi.h> #include "wayland-util.h" +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) + #define WL_ZOMBIE_OBJECT ((void *) 2) #define WL_MAP_SERVER_SIDE 0 diff --git a/src/wayland-util.h b/src/wayland-util.h index f54077e..7c8f563 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -39,8 +39,6 @@ extern "C" { #define WL_EXPORT #endif -#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) );}) |