aboutsummaryrefslogtreecommitdiff
path: root/src/shared/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/plugin.c')
-rw-r--r--src/shared/plugin.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/shared/plugin.c b/src/shared/plugin.c
index f1338788..5cdfba8a 100644
--- a/src/shared/plugin.c
+++ b/src/shared/plugin.c
@@ -46,20 +46,6 @@ typedef struct plugin
} PLUGIN;
TAILQ_HEAD(, plugin) plugins;
-#ifndef __FreeBSD__
-dlfunc_t
-dlfunc(void * __restrict handle, const char * __restrict symbol)
-{
- union {
- void *d;
- dlfunc_t f;
- } rv;
-
- rv.d = dlsym(handle, symbol);
- return rv.f;
-}
-#endif
-
void
rc_plugin_load(void)
{
@@ -68,7 +54,10 @@ rc_plugin_load(void)
PLUGIN *plugin;
char *file = NULL;
void *h;
- int (*fptr)(RC_HOOK, const char *);
+ union {
+ void *sym;
+ int (*func)(RC_HOOK, const char *);
+ } fptr;
/* Don't load plugins if we're in one */
if (rc_in_plugin)
@@ -91,9 +80,8 @@ rc_plugin_load(void)
continue;
}
- fptr = (int (*)(RC_HOOK, const char *))
- dlfunc(h, RC_PLUGIN_HOOK);
- if (fptr == NULL) {
+ fptr.sym = dlsym(h, RC_PLUGIN_HOOK);
+ if (fptr.func == NULL) {
eerror("%s: cannot find symbol `%s'",
d->d_name, RC_PLUGIN_HOOK);
dlclose(h);
@@ -101,7 +89,7 @@ rc_plugin_load(void)
plugin = xmalloc(sizeof(*plugin));
plugin->name = xstrdup(d->d_name);
plugin->handle = h;
- plugin->hook = fptr;
+ plugin->hook = fptr.func;
TAILQ_INSERT_TAIL(&plugins, plugin, entries);
}
}