]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: instance_param: simplify count check
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Sun, 15 Nov 2020 23:57:30 +0000 (08:57 +0900)
Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.

This commit simplifies the count check.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/instance-params.c

index b19382ccf074230b4437769cd9f9927c5ee8b6af..1de2a8a1e7f8b6ec978db19639383c50dc83f680 100644 (file)
@@ -223,10 +223,7 @@ void alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self,
         }
     }
 
-    if (index != count) {
-        g_free(list);
-        g_return_if_reached();
-    }
+    g_warn_if_fail(index == count);
 
     *entries = list;
     *entry_count = count;