From f3ab1f996f0647ae516ad24fbb6caf8df6d7cd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 13 Feb 2024 15:23:43 +0100 Subject: [PATCH] fp-context: use g_strv_contains instead of manual labor --- libfprint/fp-context.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c index f6c386df..70d4062a 100644 --- a/libfprint/fp-context.c +++ b/libfprint/fp-context.c @@ -77,7 +77,6 @@ is_driver_allowed (const gchar *driver) { g_auto(GStrv) allowlisted_drivers = NULL; const char *fp_drivers_allowlist_env; - int i; g_return_val_if_fail (driver, TRUE); @@ -87,12 +86,7 @@ is_driver_allowed (const gchar *driver) return TRUE; allowlisted_drivers = g_strsplit (fp_drivers_allowlist_env, ":", -1); - - for (i = 0; allowlisted_drivers[i]; ++i) - if (g_strcmp0 (driver, allowlisted_drivers[i]) == 0) - return TRUE; - - return FALSE; + return g_strv_contains ((const gchar * const *) allowlisted_drivers, driver); } typedef struct