From 4fbe3cbfc6ccafccaa47fb53cf33f681a9030088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 5 Nov 2021 16:59:51 +0100 Subject: [PATCH] pulse-server: module: use SPA_FOR_EACH_ELEMENT() Since `module_list` is a fixed-sized array, `SPA_FOR_EACH_ELEMENT()` can be used. So use that. This way there is no need for explicit indexing nor a sentinel at the end. --- src/modules/module-protocol-pulse/module.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/module-protocol-pulse/module.c b/src/modules/module-protocol-pulse/module.c index 656f473f2..f87889d5d 100644 --- a/src/modules/module-protocol-pulse/module.c +++ b/src/modules/module-protocol-pulse/module.c @@ -267,16 +267,17 @@ static const struct module_info module_list[] = { #endif { "module-roc-sink", create_module_roc_sink, }, { "module-roc-source", create_module_roc_source, }, - { NULL, } }; static const struct module_info *find_module_info(const char *name) { - int i; - for (i = 0; module_list[i].name != NULL; i++) { - if (spa_streq(module_list[i].name, name)) - return &module_list[i]; + const struct module_info *info; + + SPA_FOR_EACH_ELEMENT(module_list, info) { + if (spa_streq(info->name, name)) + return info; } + return NULL; }