Introduce enum wl_arg_type

This is less cryptic to read than letters, and allows the compiler
to check switch statements exhaustiveness.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2024-02-15 10:37:34 +01:00
parent 47de87263c
commit 155dd63b58
4 changed files with 111 additions and 92 deletions

View file

@ -191,8 +191,8 @@ verify_objects(struct wl_resource *resource, uint32_t opcode,
for (i = 0; i < count; i++) {
signature = get_next_argument(signature, &arg);
switch (arg.type) {
case 'n':
case 'o':
case WL_ARG_NEW_ID:
case WL_ARG_OBJECT:
res = (struct wl_resource *) (args[i].o);
if (res && res->client != resource->client) {
wl_log("compositor bug: The compositor "
@ -202,6 +202,8 @@ verify_objects(struct wl_resource *resource, uint32_t opcode,
object->interface->events[opcode].name);
return false;
}
default:
break;
}
}
return true;