]> code.delx.au - pulseaudio/commitdiff
native: Use foreach to iterate trough modules.
authorpoljar <poljarinho@gmail.com>
Mon, 21 May 2012 19:42:20 +0000 (21:42 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Wed, 23 May 2012 03:34:25 +0000 (06:34 +0300)
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

index 396e143c7291c829eb3409843bc23d6b4223a06a..b0fc8c8f87f195845a5325d8fdb17bf8c211723d 100644 (file)
@@ -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);