diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/plugin.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index f7a52dd..dabb4b6 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -244,27 +244,25 @@ GPluginModule *g_plugin_module_new(const gchar *filename) /* Récupération de la version d'ABI */ if (!load_plugin_symbol(module, "_chrysalide_plugin", &interface)) - goto bad_plugin; + goto no_interface; current = CURRENT_ABI_VERSION; if (current != interface->abi_version) - { - log_variadic_message(LMT_ERROR, - _("ABI mismatch detected! Plugin '%s' rejected"), - filename); - goto bad_plugin; - - } + goto wrong_abi; /* Localisation des différents points d'entrée déclarés */ -#define check_plugin_symbol(mod, sym) \ - ({ \ - bool __result; \ - __result = g_module_symbol(mod, sym, (gpointer []) { NULL }); \ - __result; \ +#define check_plugin_symbol(mod, sym) \ + ({ \ + bool __result; \ + __result = g_module_symbol(mod, sym, (gpointer []) { NULL }); \ + if (!__result) \ + log_variadic_message(LMT_ERROR, \ + _("No '%s' entry in plugin candidate '%s'"), \ + sym, filename); \ + __result; \ }) @@ -448,13 +446,13 @@ GPluginModule *g_plugin_module_new(const gchar *filename) } if (!valid) - goto bad_plugin; + goto missing_feature; gtype = build_dynamic_type(G_TYPE_PLUGIN_MODULE, interface->gtp_name, (GClassInitFunc)g_plugin_module_init_gclass, module, NULL); if (gtype == G_TYPE_INVALID) - goto bad_plugin; + goto no_instance; result = g_object_new(gtype, NULL); @@ -465,6 +463,25 @@ GPluginModule *g_plugin_module_new(const gchar *filename) return result; + no_interface: + + log_variadic_message(LMT_ERROR, _("Main interface is missing for plugin '%s'"), filename); + goto bad_plugin; + + wrong_abi: + + log_variadic_message(LMT_ERROR, _("ABI mismatch detected! Plugin '%s' rejected"), filename); + goto bad_plugin; + + missing_feature: + + log_variadic_message(LMT_ERROR, _("An expected feature is missing for plugin '%s'"), filename); + goto bad_plugin; + + no_instance: + + log_variadic_message(LMT_ERROR, _("Unabled to create an instance of plugin '%s'"), filename); + bad_plugin: g_module_close(module); |