connection: simplify wl_closure_lookup_objects() loop

Decrease the indentation a bit. No functional change.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2024-02-27 12:23:34 +01:00
parent 155dd63b58
commit 830883e5b2

View file

@ -906,38 +906,35 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
count = arg_count_for_signature(signature); count = arg_count_for_signature(signature);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
signature = get_next_argument(signature, &arg); signature = get_next_argument(signature, &arg);
switch (arg.type) { if (arg.type != WL_ARG_OBJECT)
case WL_ARG_OBJECT: continue;
id = closure->args[i].n;
closure->args[i].o = NULL;
object = wl_map_lookup(objects, id); id = closure->args[i].n;
if (wl_object_is_zombie(objects, id)) { closure->args[i].o = NULL;
/* references object we've already
* destroyed client side */
object = NULL;
} else if (object == NULL && id != 0) {
wl_log("unknown object (%u), message %s(%s)\n",
id, message->name, message->signature);
errno = EINVAL;
return -1;
}
if (object != NULL && message->types[i] != NULL && object = wl_map_lookup(objects, id);
!wl_interface_equal((object)->interface, if (wl_object_is_zombie(objects, id)) {
message->types[i])) { /* references object we've already
wl_log("invalid object (%u), type (%s), " * destroyed client side */
"message %s(%s)\n", object = NULL;
id, (object)->interface->name, } else if (object == NULL && id != 0) {
message->name, message->signature); wl_log("unknown object (%u), message %s(%s)\n",
errno = EINVAL; id, message->name, message->signature);
return -1; errno = EINVAL;
} return -1;
closure->args[i].o = object;
break;
default:
break;
} }
if (object != NULL && message->types[i] != NULL &&
!wl_interface_equal((object)->interface,
message->types[i])) {
wl_log("invalid object (%u), type (%s), "
"message %s(%s)\n",
id, (object)->interface->name,
message->name, message->signature);
errno = EINVAL;
return -1;
}
closure->args[i].o = object;
} }
return 0; return 0;