From e4d77f7e89430421f26b6460be4bc843dd76604f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 17 Mar 2022 16:24:08 +0000 Subject: [PATCH] gdbusconnection: Use g_strv_contains() rather than a home-grown version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The public `g_strv_contains()` API didn’t exist at the time this code was originally written. Now, happily, it does. Signed-off-by: Philip Withnall --- gio/gdbusconnection.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 5f6c5bc38..1159c2db4 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -282,22 +282,6 @@ call_destroy_notify (GMainContext *context, /* ---------------------------------------------------------------------------------------------------- */ -static gboolean -_g_strv_has_string (const gchar* const *haystack, - const gchar *needle) -{ - guint n; - - for (n = 0; haystack != NULL && haystack[n] != NULL; n++) - { - if (g_strcmp0 (haystack[n], needle) == 0) - return TRUE; - } - return FALSE; -} - -/* ---------------------------------------------------------------------------------------------------- */ - #ifdef G_OS_WIN32 #define CONNECTION_ENSURE_LOCK(obj) do { ; } while (FALSE) #else @@ -6544,7 +6528,7 @@ handle_subtree_introspect (GDBusConnection *connection, /* Assert existence of object if we are not dynamic */ if (!(es->flags & G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES) && - !_g_strv_has_string ((const gchar * const *) children, requested_node)) + !g_strv_contains ((const gchar * const *) children, requested_node)) goto out; } else @@ -6675,7 +6659,7 @@ handle_subtree_method_invocation (GDBusConnection *connection, es->object_path, es->user_data); - exists = _g_strv_has_string ((const gchar * const *) children, requested_node); + exists = g_strv_contains ((const gchar * const *) children, requested_node); g_strfreev (children); if (!exists)