mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
Use hash tables as sets in various places
Where we were already treating GHashTables as sets, modify them to use the set-specific APIs g_hash_table_add() and g_hash_table_contains(), to make that usage more obvious and less prone to being broken. Heavily based on patches by Garrett Regier <garrettregier@gmail.com>. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=749371
This commit is contained in:
@@ -309,7 +309,7 @@ print_names (GDBusConnection *c,
|
||||
}
|
||||
g_variant_get (result, "(as)", &iter);
|
||||
while (g_variant_iter_loop (iter, "s", &str))
|
||||
g_hash_table_insert (name_set, g_strdup (str), NULL);
|
||||
g_hash_table_add (name_set, g_strdup (str));
|
||||
g_variant_iter_free (iter);
|
||||
g_variant_unref (result);
|
||||
|
||||
@@ -333,7 +333,7 @@ print_names (GDBusConnection *c,
|
||||
}
|
||||
g_variant_get (result, "(as)", &iter);
|
||||
while (g_variant_iter_loop (iter, "s", &str))
|
||||
g_hash_table_insert (name_set, g_strdup (str), NULL);
|
||||
g_hash_table_add (name_set, g_strdup (str));
|
||||
g_variant_iter_free (iter);
|
||||
g_variant_unref (result);
|
||||
|
||||
|
Reference in New Issue
Block a user