forked from external/yambar
plugin: 'libs' -> 'plugins'
This commit is contained in:
parent
aa4fede306
commit
9fa37f0d98
1 changed files with 6 additions and 6 deletions
12
plugin.c
12
plugin.c
|
@ -15,10 +15,10 @@ struct plugin {
|
||||||
const void *sym;
|
const void *sym;
|
||||||
};
|
};
|
||||||
|
|
||||||
static tll(struct plugin) libs = tll_init();
|
static tll(struct plugin) plugins = tll_init();
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_lib(struct plugin plug)
|
free_plugin(struct plugin plug)
|
||||||
{
|
{
|
||||||
dlerror();
|
dlerror();
|
||||||
dlclose(plug.lib);
|
dlclose(plug.lib);
|
||||||
|
@ -33,7 +33,7 @@ free_lib(struct plugin plug)
|
||||||
static void __attribute__((destructor))
|
static void __attribute__((destructor))
|
||||||
fini(void)
|
fini(void)
|
||||||
{
|
{
|
||||||
tll_free_and_free(libs, free_lib);
|
tll_free_and_free(plugins, free_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info *
|
const struct module_info *
|
||||||
|
@ -43,7 +43,7 @@ plugin_load_module(const char *name)
|
||||||
snprintf(path, sizeof(path), "lib%s.so", name);
|
snprintf(path, sizeof(path), "lib%s.so", name);
|
||||||
|
|
||||||
/* Have we already loaded it? */
|
/* Have we already loaded it? */
|
||||||
tll_foreach(libs, plug) {
|
tll_foreach(plugins, plug) {
|
||||||
if (strcmp(plug->item.name, name) == 0) {
|
if (strcmp(plug->item.name, name) == 0) {
|
||||||
LOG_DBG("%s already loaded: %p", name, plug->item.lib);
|
LOG_DBG("%s already loaded: %p", name, plug->item.lib);
|
||||||
assert(plug->item.sym != NULL);
|
assert(plug->item.sym != NULL);
|
||||||
|
@ -60,8 +60,8 @@ plugin_load_module(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tll_push_back(libs, ((struct plugin){strdup(name), lib}));
|
tll_push_back(plugins, ((struct plugin){strdup(name), lib}));
|
||||||
struct plugin *plug = &tll_back(libs);
|
struct plugin *plug = &tll_back(plugins);
|
||||||
|
|
||||||
dlerror(); /* Clear previous error */
|
dlerror(); /* Clear previous error */
|
||||||
plug->sym = dlsym(lib, "module_info");
|
plug->sym = dlsym(lib, "module_info");
|
||||||
|
|
Loading…
Add table
Reference in a new issue