]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Check for cached libevent time routines
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Oct 2018 16:08:38 +0000 (17:08 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Oct 2018 16:31:43 +0000 (17:31 +0100)
CMakeLists.txt
config.h.in
src/libutil/util.h
src/lua/lua_redis.c

index dbec0ceff3b82792494e85124321aa9b0aa2e8b1..2d59bd0cc984cf9cbe0f69b3685cff0338e1c1f0 100644 (file)
@@ -1078,10 +1078,16 @@ ENDIF(HAVE_SIGINFO_H)
 
 # Some hack for libevent 2.0
 CHECK_C_SOURCE_COMPILES ("#include <event.h>
-                                       #if _EVENT_NUMERIC_VERSION < 0x02000000
+                                       #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000000
                                        #error Unsupported
                                        #endif
                                        int main() { return 0;}" HAVE_LIBEVENT2)
+CHECK_C_SOURCE_COMPILES ("#include <event2/event.h>
+                                       int main() { return EVENT_BASE_FLAG_NO_CACHE_TIME; }"
+               HAVE_EVENT_NO_CACHE_TIME_FLAG)
+LIST(APPEND CMAKE_REQUIRED_LIBRARIES "event")
+CHECK_SYMBOL_EXISTS(event_base_update_cache_time "sys/types.h;event.h"
+               HAVE_EVENT_NO_CACHE_TIME_FUNC)
 
 IF(NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
 IF(HAVE_CLOCK_GETTIME)
index cb38c87f45d204d6bbd564eb2ad9352af860b991..66f287e0352026511bc92201759791093a859722 100644 (file)
@@ -42,6 +42,8 @@
 #cmakedefine HAVE_IPV6_V6ONLY    1
 #cmakedefine HAVE_LIBAIO_H       1
 #cmakedefine HAVE_LIBEVENT2      1
+#cmakedefine HAVE_EVENT_NO_CACHE_TIME_FLAG 1
+#cmakedefine HAVE_EVENT_NO_CACHE_TIME_FUNC 1
 #cmakedefine HAVE_LIBGEN_H       1
 #cmakedefine HAVE_LIBUTIL_H      1
 #cmakedefine HAVE_LOCALE_H       1
index 8753884322c00da2a30e00ae9ac5b33dcd4090f5..e97593d2151e960123940eebca11ce1df511db3b 100644 (file)
@@ -11,6 +11,7 @@
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
+
 #include <event.h>
 #include <time.h>
 
index 74f446c4f094c54025fe8d4408b2a7ef71704050..65c0609f93ccca683cef2226541c9da7173cf78a 100644 (file)
@@ -1006,7 +1006,7 @@ lua_redis_make_request (lua_State *L)
                lua_pop (L, 1);
 
                lua_pushstring (L, "timeout");
-               lua_gettable (L, -2);
+               lua_gettable (L, 1);
                if (lua_type (L, -1) == LUA_TNUMBER) {
                        timeout = lua_tonumber (L, -1);
                }
@@ -1015,7 +1015,7 @@ lua_redis_make_request (lua_State *L)
 
 
                lua_pushstring (L, "args");
-               lua_gettable (L, -2);
+               lua_gettable (L, 1);
                lua_redis_parse_args (L, -1, cmd, &sp_ud->args, &sp_ud->arglens,
                                &sp_ud->nargs);
                lua_pop (L, 1);