aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-02-27 12:23:34 +0100
committerSimon Ser <contact@emersion.fr>2024-03-06 14:18:18 +0100
commit830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc (patch)
treee42b60d1b641c9af1a85f49fcb3dbaadccccada8
parentIntroduce enum wl_arg_type (diff)
downloadwayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar.gz
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar.bz2
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar.lz
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar.xz
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.tar.zst
wayland-830883e5b2d3ec20a4f73258bdd97d12e5e9c9bc.zip
connection: simplify wl_closure_lookup_objects() loop
Decrease the indentation a bit. No functional change. Signed-off-by: Simon Ser <contact@emersion.fr>
-rw-r--r--src/connection.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/connection.c b/src/connection.c
index 3eb6622..0cfb611 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -906,38 +906,35 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
count = arg_count_for_signature(signature);
for (i = 0; i < count; i++) {
signature = get_next_argument(signature, &arg);
- switch (arg.type) {
- case WL_ARG_OBJECT:
- id = closure->args[i].n;
- closure->args[i].o = NULL;
+ if (arg.type != WL_ARG_OBJECT)
+ continue;
- object = wl_map_lookup(objects, id);
- if (wl_object_is_zombie(objects, id)) {
- /* 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;
- }
+ id = closure->args[i].n;
+ closure->args[i].o = NULL;
- 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;
- break;
- default:
- break;
+ object = wl_map_lookup(objects, id);
+ if (wl_object_is_zombie(objects, id)) {
+ /* 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 &&
+ !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;