aboutsummaryrefslogtreecommitdiff
path: root/src/shared/plugin.c
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-20 15:16:00 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-20 15:16:00 +0200
commit15de84d70ccd57afd7ad5af5cf95cef7fc542141 (patch)
tree7503973dac92c91eaf0ccaac946a4be46dfd7613 /src/shared/plugin.c
parent1485cfb36cbdc2a079f73be16670cb3e64567852 (diff)
shared/plugin.c: fix incompatible function warning.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
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);
}
}