unpretty fix for backend2str.

git-svn-id: file:///svn/unbound/trunk@3661 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2016-03-10 14:49:16 +00:00
parent 6a6cf23179
commit ecb9007bb0
2 changed files with 18 additions and 3 deletions

View file

@ -94,7 +94,7 @@ const char* ub_event_get_version()
}
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
static const char* ev_backend2str(int b)
static const char* ub_ev_backend2str(int b)
{
switch(b) {
case EVBACKEND_SELECT: return "select";
@ -129,7 +129,7 @@ ub_get_event_sys(struct ub_event_base* base, const char** n, const char** s,
*n = "libev";
if (!b)
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
*m = ev_backend2str(ev_backend((struct ev_loop*)b));
*m = ub_ev_backend2str(ev_backend((struct ev_loop*)b));
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
*n = "libevent";
if (!b)

View file

@ -364,6 +364,21 @@ ub_libevent_get_event_base(struct ub_event_base* base)
return NULL;
}
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
static const char* ub_ev_backend2str_pluggable(int b)
{
switch(b) {
case EVBACKEND_SELECT: return "select";
case EVBACKEND_POLL: return "poll";
case EVBACKEND_EPOLL: return "epoll";
case EVBACKEND_KQUEUE: return "kqueue";
case EVBACKEND_DEVPOLL: return "devpoll";
case EVBACKEND_PORT: return "evport";
}
return "unknown";
}
#endif
void
ub_get_event_sys(struct ub_event_base* ub_base, const char** n, const char** s,
const char** m)
@ -391,7 +406,7 @@ ub_get_event_sys(struct ub_event_base* ub_base, const char** n, const char** s,
*m = event_base_get_method(b);
# elif defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
*n = "pluggable-libev";
*m = ev_backend2str(ev_backend((struct ev_loop*)b);
*m = ub_ev_backend2str_pluggable(ev_backend((struct ev_loop*)b));
# else
*m = "not obtainable";
# endif