summaryrefslogtreecommitdiff
path: root/plugins.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-14 21:49:42 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-14 21:49:42 +0200
commit65f4f805b8cde95dc4f6c422a9168e42086c6d25 (patch)
tree4c6b458e6b4c8c81de2814fe5b755916a5a09cbc /plugins.c
parent88dab82d6785478df2874239c23c1e0da2813399 (diff)
sort plugin list alphabetically
Diffstat (limited to 'plugins.c')
-rw-r--r--plugins.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins.c b/plugins.c
index 4fcfde34..ffa381c1 100644
--- a/plugins.c
+++ b/plugins.c
@@ -321,7 +321,9 @@ typedef struct plugin_s {
DB_plugin_t *plugin;
struct plugin_s *next;
} plugin_t;
+
plugin_t *plugins;
+plugin_t *plugins_tail;
void
plug_ev_subscribe (DB_plugin_t *plugin, int ev, DB_callback_t callback, uintptr_t data) {
@@ -533,8 +535,13 @@ plug_init_plugin (DB_plugin_t* (*loadfunc)(DB_functions_t *), void *handle) {
memset (plug, 0, sizeof (plugin_t));
plug->plugin = plugin_api;
plug->handle = handle;
- plug->next = plugins;
- plugins = plug;
+ if (plugins_tail) {
+ plugins_tail->next = plug;
+ plugins_tail = plug;
+ }
+ else {
+ plugins = plugins_tail = plug;
+ }
return 0;
}
@@ -746,6 +753,7 @@ plug_unload_all (void) {
free (plugins);
plugins = next;
}
+ plugins_tail = NULL;
fprintf (stderr, "all plugins had been unloaded\n");
}