-static
-void component_destroy(gpointer data)
-{
- g_free(data);
-}
-
-static
-void plugin_destroy(gpointer data)
-{
- struct plugin *plugin = data;
-
- if (plugin->module && g_module_close(plugin->module)) {
- printf_error("Failed to close plugin");
- }
-
- if (plugin->components) {
- g_ptr_array_free(plugin->components, TRUE);
- }
-
- g_free(plugin);
-}
-
-static
-struct plugin *plugin_create(void)
-{
- struct plugin *plugin = g_new0(struct plugin, 1);
-
- if (!plugin) {
- goto end;
- }
-
- plugin->components = g_ptr_array_new_with_free_func(component_destroy);
- if (!plugin->components) {
- g_free(plugin);
- plugin = NULL;
- goto end;
- }
-end:
- return plugin;
-}
-