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:
Philip Withnall
2017-10-25 10:53:14 +01:00
parent e130d2e511
commit 3eacec1587
9 changed files with 25 additions and 22 deletions

View File

@@ -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);