module: use g_hash_table_add()

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>
This commit is contained in:
Marc-André Lureau 2019-07-22 17:10:46 +04:00 committed by Paolo Bonzini
parent c932ce3144
commit 90629122d2

View 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");