]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fix compile for ub_event code with older libev.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 14 Mar 2016 13:45:51 +0000 (13:45 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 14 Mar 2016 13:45:51 +0000 (13:45 +0000)
git-svn-id: file:///svn/unbound/trunk@3672 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/ub_event.c
util/ub_event_pluggable.c

index 2118b81ad222963a2512cc2aa2c15ea2c023a2ef..992ad5cdc3033e644fa1b4052c23296e2068cd40 100644 (file)
@@ -1,5 +1,6 @@
 14 March 2016: Wouter
        - Fix warnings in ifdef corner case, older or unknown libevent.
+       - Fix compile for ub_event code with older libev.
 
 11 March 2016: Wouter
        - Remove warning about unused parameter in event_pluggable.c.
index 5ddeefb84714bc34214ec9b37953a16892ca0221..af2a18ea0fc82f7fd22d59f114f24d6618ff5429 100644 (file)
@@ -128,6 +128,10 @@ static void (*NATIVE_BITS_CB(void (*cb)(int, short, void*)))(int, short, void*)
 #  define NATIVE_BITS_CB(c) (c)
 #endif
 
+#ifndef EVFLAG_AUTO
+#define EVFLAG_AUTO 0
+#endif
+
 #define AS_EVENT_BASE(x) \
        (((union {struct ub_event_base* a; struct event_base* b;})x).b)
 #define AS_UB_EVENT_BASE(x) \
@@ -142,7 +146,7 @@ const char* ub_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)
 {
        switch(b) {
@@ -178,7 +182,11 @@ 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);
+#    ifdef EVBACKEND_SELECT
        *m = ub_ev_backend2str(ev_backend((struct ev_loop*)b));
+#    else
+       *m = "not obtainable";
+#    endif
 #  elif defined(HAVE_EVENT_BASE_GET_METHOD)
        *n = "libevent";
        if (!b)
index ccc7d64d5241e85fdf16fbb09449189939dfadc1..5c517555e71b92ae49f92d9151fb124f467e022c 100644 (file)
@@ -130,6 +130,10 @@ static void (*NATIVE_BITS_CB(void (*cb)(int, short, void*)))(int, short, void*)
 #  define NATIVE_BITS_CB(c) (c)
 #endif
 
+#ifndef EVFLAG_AUTO
+#define EVFLAG_AUTO 0
+#endif
+
 struct my_event_base {
        struct ub_event_base super;
        struct event_base* base;
@@ -416,7 +420,7 @@ ub_libevent_get_event_base(struct ub_event_base* base)
        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)
 {
        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();
 #  if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
        *n = "pluggable-libev";
+#    ifdef EVBACKEND_SELECT
        *m = ub_ev_backend2str_pluggable(ev_backend((struct ev_loop*)b));
+#    else
+       *m = "not obtainable";
+#    endif
 #  elif defined(HAVE_EVENT_BASE_GET_METHOD)
        *n = "pluggable-libevent";
        *m = event_base_get_method(b);