Skip to content

Commit

Permalink
cli/libxdp: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hack3ric committed Dec 16, 2024
1 parent 4928996 commit d46b693
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/libxdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ static int dlsym_many_or_warnv(void *dl, va_list ap) {
void (**fn)(void);

while ((fn = va_arg(ap, typeof(fn)))) {
void (*tfn)(void);
const char *symbol;

symbol = va_arg(ap, typeof(symbol));

tfn = (typeof(tfn))dlsym(dl, symbol);
const char* symbol = va_arg(ap, typeof(symbol));
void (*tfn)(void) = dlsym(dl, symbol);
if (!tfn) {
log_warn(_("cannot find symbol '%s': %s"), symbol, dlerror());
return -ELIBBAD;
Expand All @@ -36,12 +32,10 @@ static int dlsym_many_or_warnv(void *dl, va_list ap) {
}

static int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, ...) {
void *dl = NULL;
int retcode;

if (*dlp) return 0;

dl = dlopen(filename, RTLD_NOW | RTLD_NODELETE);
void* dl = dlopen(filename, RTLD_NOW | RTLD_NODELETE);
if (!dl) {
log_warn(_("%s is not installed: %s"), filename, dlerror());
return -EOPNOTSUPP;
Expand Down
1 change: 0 additions & 1 deletion src/libxdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <xdp/libxdp.h>

#define DLSYM_PROTOTYPE(symbol) typeof(symbol)* sym_##symbol

#define DLSYM_ARG(arg) \
({ \
assert(__builtin_types_compatible_p(typeof(sym_##arg), typeof(&arg))); \
Expand Down

0 comments on commit d46b693

Please sign in to comment.