Plugin enumerator enumerates over loaded features, too

This commit is contained in:
Martin Willi
2011-10-14 10:05:44 +02:00
parent 36b4f05b14
commit fa7c8338ca
7 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ static void print_plugins()
buf[0] = '\0';
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (len < sizeof(buf) && enumerator->enumerate(enumerator, &plugin))
while (len < sizeof(buf) && enumerator->enumerate(enumerator, &plugin, NULL))
{
len += snprintf(&buf[len], sizeof(buf)-len, "%s ",
plugin->get_name(plugin));
+1 -1
View File
@@ -451,7 +451,7 @@ METHOD(stroke_list_t, status, void,
lib->scheduler->get_job_load(lib->scheduler));
fprintf(out, " loaded plugins: ");
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (enumerator->enumerate(enumerator, &plugin))
while (enumerator->enumerate(enumerator, &plugin, NULL))
{
fprintf(out, "%s ", plugin->get_name(plugin));
}
+6 -1
View File
@@ -177,9 +177,14 @@ static bool load_plugin(private_plugin_loader_t *this, char *name, char *file)
/**
* Convert enumerated entries to plugin_t
*/
static bool plugin_filter(void *null, plugin_entry_t **entry, plugin_t **plugin)
static bool plugin_filter(void *null, plugin_entry_t **entry, plugin_t **plugin,
void *in, linked_list_t **list)
{
*plugin = (*entry)->plugin;
if (list)
{
*list = (*entry)->loaded;
}
return TRUE;
}
+5 -1
View File
@@ -59,7 +59,11 @@ struct plugin_loader_t {
/**
* Create an enumerator over all loaded plugins.
*
* @return enumerator over plugin_t*
* In addition to the plugin, a to read-only list is enumerated (if it is
* not NULL). This list contains pointer to plugin features currently
* loaded.
*
* @return enumerator over plugin_t*, linked_list_t*
*/
enumerator_t* (*create_plugin_enumerator)(plugin_loader_t *this);
+1 -1
View File
@@ -841,7 +841,7 @@ static void show_loaded_plugins()
buf[0] = '\0';
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL))
{
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
}
+1 -1
View File
@@ -271,7 +271,7 @@ static void print_plugins()
buf[0] = '\0';
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL))
{
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
}
+1 -1
View File
@@ -286,7 +286,7 @@ static void print_plugins()
enumerator_t *enumerator;
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL))
{
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
}