#include "macro.h"
-DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(void*, dlclose, NULL);
+static inline void* safe_dlclose(void *dl) {
+ if (!dl)
+ return NULL;
+
+ assert_se(dlclose(dl) == 0);
+ return NULL;
+}
+
+static inline void dlclosep(void **dlp) {
+ safe_dlclose(*dlp);
+}
int dlsym_many_or_warn_sentinel(void *dl, int log_level, ...) _sentinel_;
int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, int log_level, ...) _sentinel_;
/* libbpf is a bit confused about type-safety and API compatibility. Provide a macro that can tape over that mess. Sad. */
#define DLSYM_ARG_FORCE(arg) \
&sym_##arg, STRINGIFY(arg)
-
-static inline void *safe_dlclose(void *p) {
- if (!p)
- return NULL;
-
- assert_se(dlclose(p) == 0);
- return NULL;
-}