[pulseaudio-commits] src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Tue May 22 20:35:32 PDT 2012
src/pulsecore/protocol-native.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 4c65e58325fabde724eb340da6ce2c9988e45871
Author: poljar <poljarinho at gmail.com>
Date: Mon May 21 21:42:20 2012 +0200
native: Use foreach to iterate trough modules.
The PA_IDXSET_FOREACH is easier to read than the standard for loop.
Also pa_streq() should be used for checking string equality.
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 396e143..b0fc8c8 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4623,11 +4623,10 @@ 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)
+ else
+ PA_IDXSET_FOREACH(m, c->protocol->core->modules, idx)
+ if (pa_streq(name, m->name))
break;
- }
CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOEXTENSION);
CHECK_VALIDITY(c->pstream, m->load_once || idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
More information about the pulseaudio-commits
mailing list