Migrated plugin_loader to INIT/METHOD macros
This commit is contained in:
@@ -166,10 +166,8 @@ static bool plugin_loaded(private_plugin_loader_t *this, char *name)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_loader_t, load_plugins, bool,
|
||||||
* Implementation of plugin_loader_t.load_plugins.
|
private_plugin_loader_t *this, char *path, char *list)
|
||||||
*/
|
|
||||||
static bool load(private_plugin_loader_t *this, char *path, char *list)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
char *token;
|
char *token;
|
||||||
@@ -219,10 +217,8 @@ static bool load(private_plugin_loader_t *this, char *path, char *list)
|
|||||||
return !critical_failed;
|
return !critical_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_loader_t, unload, void,
|
||||||
* Implementation of plugin_loader_t.unload
|
private_plugin_loader_t *this)
|
||||||
*/
|
|
||||||
static void unload(private_plugin_loader_t *this)
|
|
||||||
{
|
{
|
||||||
plugin_t *plugin;
|
plugin_t *plugin;
|
||||||
char *name;
|
char *name;
|
||||||
@@ -239,18 +235,14 @@ static void unload(private_plugin_loader_t *this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_loader_t, create_plugin_enumerator, enumerator_t*,
|
||||||
* Implementation of plugin_loader_t.create_plugin_enumerator
|
private_plugin_loader_t *this)
|
||||||
*/
|
|
||||||
static enumerator_t* create_plugin_enumerator(private_plugin_loader_t *this)
|
|
||||||
{
|
{
|
||||||
return this->names->create_enumerator(this->names);
|
return this->names->create_enumerator(this->names);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_loader_t, destroy, void,
|
||||||
* Implementation of plugin_loader_t.destroy
|
private_plugin_loader_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_plugin_loader_t *this)
|
|
||||||
{
|
{
|
||||||
this->plugins->destroy_offset(this->plugins, offsetof(plugin_t, destroy));
|
this->plugins->destroy_offset(this->plugins, offsetof(plugin_t, destroy));
|
||||||
this->names->destroy_function(this->names, free);
|
this->names->destroy_function(this->names, free);
|
||||||
@@ -262,15 +254,18 @@ static void destroy(private_plugin_loader_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_loader_t *plugin_loader_create()
|
plugin_loader_t *plugin_loader_create()
|
||||||
{
|
{
|
||||||
private_plugin_loader_t *this = malloc_thing(private_plugin_loader_t);
|
private_plugin_loader_t *this;
|
||||||
|
|
||||||
this->public.load = (bool(*)(plugin_loader_t*, char *path, char *prefix))load;
|
INIT(this,
|
||||||
this->public.unload = (void(*)(plugin_loader_t*))unload;
|
.public = {
|
||||||
this->public.create_plugin_enumerator = (enumerator_t*(*)(plugin_loader_t*))create_plugin_enumerator;
|
.load = _load,
|
||||||
this->public.destroy = (void(*)(plugin_loader_t*))destroy;
|
.unload = _unload,
|
||||||
|
.create_plugin_enumerator = _create_plugin_enumerator,
|
||||||
this->plugins = linked_list_create();
|
.destroy = _destroy,
|
||||||
this->names = linked_list_create();
|
},
|
||||||
|
.plugins = linked_list_create(),
|
||||||
|
.names = linked_list_create(),
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user