From f2554d4676ec6d64a108113e04baa2dd313e3a96 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sun, 15 Nov 2020 23:04:32 +0900 Subject: [PATCH] hwdep: 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 --- src/hwdep/query.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hwdep/query.c b/src/hwdep/query.c index 4abba68..f5efa81 100644 --- a/src/hwdep/query.c +++ b/src/hwdep/query.c @@ -192,12 +192,9 @@ void alsahwdep_get_device_id_list(guint card_id, guint **entries, 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); -- 2.47.3