From: Takashi Sakamoto Date: Sun, 15 Nov 2020 14:04:32 +0000 (+0900) Subject: ctl: query: simplify count check X-Git-Tag: v0.1.99~35 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=e9cc3d5c39bc69cb1a8bca68ac2d846f2cfdfda9;p=alsa-gobject.git ctl: query: simplify count check 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 --- diff --git a/src/ctl/query.c b/src/ctl/query.c index dcd2cd3..3cf99c9 100644 --- a/src/ctl/query.c +++ b/src/ctl/query.c @@ -165,12 +165,9 @@ void alsactl_get_card_id_list(guint **entries, gsize *entry_count, udev_device_unref(dev); } } - if (index != count) { - g_warn_if_reached(); - g_free(*entries); - *entries = NULL; - goto end; - } + + g_warn_if_fail(index == count); + *entry_count = count; qsort(*entries, count, sizeof(guint), compare_guint);