[pulseaudio-discuss] [PATCH] protocol-native: Use foreach to iterate trough modules.
poljar
poljarinho at gmail.com
Tue May 22 05:37:09 PDT 2012
The PA_IDXSET_FOREACH is easier to read than the standard for loop.
Also pa_streq() should be used for checking string equality.
---
src/pulsecore/protocol-native.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index c2d5fcf..f221d21 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4621,8 +4621,8 @@ static void command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag,
if (idx != PA_INVALID_INDEX)
m = pa_idxset_get_by_index(c->protocol->core->modules, idx);
else {
- for (m = pa_idxset_first(c->protocol->core->modules, &idx); m; m = pa_idxset_next(c->protocol->core->modules, &idx))
- if (strcmp(name, m->name) == 0)
+ PA_IDXSET_FOREACH(m, c->protocol->core->modules, idx) {
+ if (pa_streq(name, m->name))
break;
}
--
1.7.10.2
More information about the pulseaudio-discuss
mailing list