mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Fix compile for ub_event code with older libev.
git-svn-id: file:///svn/unbound/trunk@3672 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
c9a5913cf8
commit
197a50ea96
3 changed files with 19 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
14 March 2016: Wouter
|
14 March 2016: Wouter
|
||||||
- Fix warnings in ifdef corner case, older or unknown libevent.
|
- Fix warnings in ifdef corner case, older or unknown libevent.
|
||||||
|
- Fix compile for ub_event code with older libev.
|
||||||
|
|
||||||
11 March 2016: Wouter
|
11 March 2016: Wouter
|
||||||
- Remove warning about unused parameter in event_pluggable.c.
|
- Remove warning about unused parameter in event_pluggable.c.
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,10 @@ static void (*NATIVE_BITS_CB(void (*cb)(int, short, void*)))(int, short, void*)
|
||||||
# define NATIVE_BITS_CB(c) (c)
|
# define NATIVE_BITS_CB(c) (c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EVFLAG_AUTO
|
||||||
|
#define EVFLAG_AUTO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AS_EVENT_BASE(x) \
|
#define AS_EVENT_BASE(x) \
|
||||||
(((union {struct ub_event_base* a; struct event_base* b;})x).b)
|
(((union {struct ub_event_base* a; struct event_base* b;})x).b)
|
||||||
#define AS_UB_EVENT_BASE(x) \
|
#define AS_UB_EVENT_BASE(x) \
|
||||||
|
|
@ -142,7 +146,7 @@ const char* ub_event_get_version()
|
||||||
return event_get_version();
|
return event_get_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
#if (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && defined(EVBACKEND_SELECT)
|
||||||
static const char* ub_ev_backend2str(int b)
|
static const char* ub_ev_backend2str(int b)
|
||||||
{
|
{
|
||||||
switch(b) {
|
switch(b) {
|
||||||
|
|
@ -178,7 +182,11 @@ ub_get_event_sys(struct ub_event_base* base, const char** n, const char** s,
|
||||||
*n = "libev";
|
*n = "libev";
|
||||||
if (!b)
|
if (!b)
|
||||||
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
|
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
|
||||||
|
# ifdef EVBACKEND_SELECT
|
||||||
*m = ub_ev_backend2str(ev_backend((struct ev_loop*)b));
|
*m = ub_ev_backend2str(ev_backend((struct ev_loop*)b));
|
||||||
|
# else
|
||||||
|
*m = "not obtainable";
|
||||||
|
# endif
|
||||||
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
|
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
|
||||||
*n = "libevent";
|
*n = "libevent";
|
||||||
if (!b)
|
if (!b)
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,10 @@ static void (*NATIVE_BITS_CB(void (*cb)(int, short, void*)))(int, short, void*)
|
||||||
# define NATIVE_BITS_CB(c) (c)
|
# define NATIVE_BITS_CB(c) (c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EVFLAG_AUTO
|
||||||
|
#define EVFLAG_AUTO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
struct my_event_base {
|
struct my_event_base {
|
||||||
struct ub_event_base super;
|
struct ub_event_base super;
|
||||||
struct event_base* base;
|
struct event_base* base;
|
||||||
|
|
@ -416,7 +420,7 @@ ub_libevent_get_event_base(struct ub_event_base* base)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
#if (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && defined(EVBACKEND_SELECT)
|
||||||
static const char* ub_ev_backend2str_pluggable(int b)
|
static const char* ub_ev_backend2str_pluggable(int b)
|
||||||
{
|
{
|
||||||
switch(b) {
|
switch(b) {
|
||||||
|
|
@ -456,7 +460,11 @@ ub_get_event_sys(struct ub_event_base* ub_base, const char** n, const char** s,
|
||||||
*s = event_get_version();
|
*s = event_get_version();
|
||||||
# if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
# if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
||||||
*n = "pluggable-libev";
|
*n = "pluggable-libev";
|
||||||
|
# ifdef EVBACKEND_SELECT
|
||||||
*m = ub_ev_backend2str_pluggable(ev_backend((struct ev_loop*)b));
|
*m = ub_ev_backend2str_pluggable(ev_backend((struct ev_loop*)b));
|
||||||
|
# else
|
||||||
|
*m = "not obtainable";
|
||||||
|
# endif
|
||||||
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
|
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
|
||||||
*n = "pluggable-libevent";
|
*n = "pluggable-libevent";
|
||||||
*m = event_base_get_method(b);
|
*m = event_base_get_method(b);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue