[glib: 1/3] gdbusconnection: Use g_strv_contains() rather than a home-grown version
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] gdbusconnection: Use g_strv_contains() rather than a home-grown version
- Date: Fri, 18 Mar 2022 09:04:15 +0000 (UTC)
commit e4d77f7e89430421f26b6460be4bc843dd76604f
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Mar 17 16:24:08 2022 +0000
gdbusconnection: Use g_strv_contains() rather than a home-grown version
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 <pwithnall endlessos org>
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]