]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
module: use g_hash_table_add()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 22 Jul 2019 13:10:46 +0000 (17:10 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Aug 2019 14:29:57 +0000 (16:29 +0200)
The hashtable is used like a set, use the convenience
g_hash_table_add() function.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/module.c

index 142db7e911caa382023dca8ce79504c6a7de76e6..ca9885c490b2d12d0ff76e4dafe126797a9f02e9 100644 (file)
@@ -179,11 +179,10 @@ void module_load_one(const char *prefix, const char *lib_name)
 
     module_name = g_strdup_printf("%s%s", prefix, lib_name);
 
-    if (g_hash_table_lookup(loaded_modules, module_name)) {
+    if (!g_hash_table_add(loaded_modules, module_name)) {
         g_free(module_name);
         return;
     }
-    g_hash_table_insert(loaded_modules, module_name, module_name);
 
     exec_dir = qemu_get_exec_dir();
     search_dir = getenv("QEMU_MODULE_DIR");