-
-void *plugin_create(char *name /* TODO */)
-{
- Plugin *p = (Plugin *)g_datalist_get_data(&plugins, name);
-
- if (p == NULL) {
- g_warning("Unable to find plugin for create: %s", name);
- return NULL;
- }
-
- if (p->create == NULL || p->destroy == NULL) {
- g_critical("Unsupported create/destroy: %s", name);
- return NULL;
- }
-
- return p->create();
-}
-
-void plugin_destroy(char *name, void *data)
-{
- Plugin *p = (Plugin *)g_datalist_get_data(&plugins, name);
-
- if (p == NULL) {
- g_critical("Unable to find plugin for destroy: %s", name);
- /* really shouldn't happen, but attempt to free something anyway? */
- g_free(data);
- return;
- }
-
- if (p->destroy == NULL || p->create == NULL) {
- g_critical("Unsupported create/destroy: %s", name);
- /* really, really shouldn't happen, but attempt to free anyway? */
- g_free(data);
- return;
- }
-
- p->destroy(data);
-}