a few minor clean-ups
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Sep 2008 23:30:48 +0000 (01:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Sep 2008 23:30:48 +0000 (01:30 +0200)
src/pulse/channelmap.c

index 7df6d6d..3730875 100644 (file)
@@ -288,9 +288,6 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
         case PA_CHANNEL_MAP_AUX: {
             unsigned i;
 
-            if (channels >= PA_CHANNELS_MAX)
-                return NULL;
-
             for (i = 0; i < channels; i++)
                 m->map[i] = PA_CHANNEL_POSITION_AUX0 + i;
 
@@ -491,7 +488,7 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
     pa_assert(rmap);
     pa_assert(s);
 
-    memset(&map, 0, sizeof(map));
+    pa_channel_map_init(&map);
 
     if (strcmp(s, "stereo") == 0) {
         map.channels = 2;
@@ -554,11 +551,9 @@ int pa_channel_map_valid(const pa_channel_map *map) {
     if (map->channels <= 0 || map->channels > PA_CHANNELS_MAX)
         return 0;
 
-    for (c = 0; c < map->channels; c++) {
-
-        if (map->map[c] < 0 ||map->map[c] >= PA_CHANNEL_POSITION_MAX)
+    for (c = 0; c < map->channels; c++)
+        if (map->map[c] < 0 || map->map[c] >= PA_CHANNEL_POSITION_MAX)
             return 0;
-    }
 
     return 1;
 }