Use hash table to store plugins

This commit is contained in:
James Booth
2016-06-30 23:58:04 +01:00
parent bb33522e4d
commit 3bd3de036f
4 changed files with 143 additions and 109 deletions

View File

@@ -1894,13 +1894,13 @@ _plugins_autocomplete(ProfWin *window, const char *const input)
if (strncmp(input, "/plugins unload ", 16) == 0) {
if (plugins_unload_ac == NULL) {
plugins_unload_ac = autocomplete_new();
GSList *plugins = plugins_loaded_list();
GSList *curr = plugins;
GList *plugins = plugins_loaded_list();
GList *curr = plugins;
while (curr) {
autocomplete_add(plugins_unload_ac, curr->data);
curr = g_slist_next(curr);
curr = g_list_next(curr);
}
g_slist_free(plugins);
g_list_free(plugins);
}
result = autocomplete_param_with_ac(input, "/plugins unload", plugins_unload_ac, TRUE);
if (result) {

View File

@@ -6053,19 +6053,19 @@ cmd_plugins(ProfWin *window, const char *const command, gchar **args)
return TRUE;
} else {
GSList *plugins = plugins_get_list();
GSList *curr = plugins;
if (curr == NULL) {
GList *plugins = plugins_loaded_list();
if (plugins == NULL) {
cons_show("No plugins installed.");
} else {
cons_show("Installed plugins:");
while (curr) {
ProfPlugin *plugin = curr->data;
cons_show(" %s", plugin->name);
curr = g_slist_next(curr);
}
return TRUE;
}
g_slist_free(curr);
GList *curr = plugins;
cons_show("Installed plugins:");
while (curr) {
cons_show(" %s", curr->data);
curr = g_list_next(curr);
}
g_list_free(plugins);
return TRUE;
}