static gboolean _ms_module_dispatch_timeout_callback(gpointer data);
static gboolean _ms_module_enable_dispatch_timeout_callback(int cmd, muse_module_h m);
-static gboolean _ms_module_free_key(gpointer key, gpointer value, gpointer user_data);
static void _ms_module_set_loaded_dllsym(int idx, GModule *dllsym, gboolean value);
static gboolean _ms_module_dispatch_timeout_callback(gpointer data)
SECURE_LOGD("dll_handle: %p", module->dllsym);
}
-static gboolean _ms_module_free_key(gpointer key, gpointer value, gpointer user_data)
-{
- MUSE_G_FREE(key);
- return TRUE;
-}
-
GModule *ms_module_open(int idx)
{
GModule *dllsym = NULL;
void ms_module_set_dllsym_value(int idx, const char *name, gpointer value)
{
- gpointer orig_key;
ms_module_t *module = ms_get_module_instance(idx);
g_return_if_fail(module);
g_return_if_fail(name);
g_mutex_lock(&dllsym_table_lock);
-
- /* Try looking up this key. */
- if (g_hash_table_lookup_extended(module->dllsym_table, name, &orig_key, NULL)) {
- g_hash_table_remove(module->dllsym_table, name);
- g_hash_table_insert(module->dllsym_table, g_strdup(name), value);
- g_free(orig_key);
- } else {
- /* Insert into our hash table it is not a duplicate. */
- g_hash_table_insert(module->dllsym_table, g_strdup(name), value);
- }
-
+ g_hash_table_insert(module->dllsym_table, g_strdup(name), value);
g_mutex_unlock(&dllsym_table_lock);
}
g_mutex_clear(&module->lock);
g_module_close(module->dllsym);
- g_hash_table_foreach_remove(module->dllsym_table, _ms_module_free_key, NULL);
g_hash_table_destroy(module->dllsym_table);
free(module);
g_mutex_init(&module->lock);
module->loaded = FALSE;
- module->dllsym_table = g_hash_table_new(g_str_hash, g_str_equal);
+ module->dllsym_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
g_return_if_fail(module->dllsym_table);
for (disp_idx = 0; disp_idx < MUSE_DISPATCHER_MAX; disp_idx++)
ms_module_set_timeout(module->idx, disp_idx, ms_get_instance()->conf->host_infos[module->idx]->timeout);