casper: convert macros to inline functions

In libcasper, the first argument to the function is a structure that
represents a connection to Casper. On systems without Casper, macros
are used to interpose the Casper functions to standard libc ones.
This may cause errors/warnings that the variable is not used.
With the inline function, there is no such problem.

I omitted this file in: 8c121177f0
This commit is contained in:
Mariusz Zaborski 2021-01-12 19:38:10 +01:00
parent 6e5baec33c
commit d2ceee38ca

View File

@ -123,8 +123,21 @@ cap_channel_t *cap_service_open(const cap_channel_t *chan, const char *name);
int cap_service_limit(const cap_channel_t *chan, int cap_service_limit(const cap_channel_t *chan,
const char * const *names, size_t nnames); const char * const *names, size_t nnames);
#else #else
#define cap_service_open(chan, name) (cap_init()) static inline cap_channel_t *
#define cap_service_limit(chan, names, nnames) (0) cap_service_open(const cap_channel_t *chan __unused,
const char *name __unused)
{
return (cap_init());
}
static inline int
cap_service_limit(const cap_channel_t *chan __unused,
const char * const *names __unused, size_t nnames __unused)
{
return (0);
}
#endif #endif
/* /*
@ -229,7 +242,13 @@ int cap_sock(const cap_channel_t *chan);
#ifdef WITH_CASPER #ifdef WITH_CASPER
int cap_limit_set(const cap_channel_t *chan, nvlist_t *limits); int cap_limit_set(const cap_channel_t *chan, nvlist_t *limits);
#else #else
#define cap_limit_set(chan, limits) (0) static inline int
cap_limit_set(const cap_channel_t *chan __unused,
nvlist_t *limits __unused)
{
return (0);
}
#endif #endif
/* /*