diff options
author | Duncan Bellamy <dunk@denkimushi.com> | 2021-05-24 14:17:34 +0100 |
---|---|---|
committer | Duncan Bellamy <dunk@denkimushi.com> | 2021-05-29 09:02:05 +0100 |
commit | ab72e9d492987ff27a480bdc5011b447c2ada520 (patch) | |
tree | d8ed9e63be652f4c1c0c733280b6873f5b4610a2 | |
parent | ab8882972d32c737afeda1902f96879f75f0a512 (diff) | |
download | rspamd-ab72e9d492987ff27a480bdc5011b447c2ada520.tar.gz rspamd-ab72e9d492987ff27a480bdc5011b447c2ada520.zip |
[Minor] change headers for zstd depending on bundled or system used
follow on patch from #3764
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/client/rspamdclient.c | 7 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 8 | ||||
-rw-r--r-- | src/libserver/maps/map.c | 7 | ||||
-rw-r--r-- | src/libserver/protocol.c | 7 | ||||
-rw-r--r-- | src/libserver/task.c | 9 | ||||
-rw-r--r-- | src/lua/lua_compress.c | 12 | ||||
-rw-r--r-- | src/rspamd_proxy.c | 7 |
8 files changed, 47 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a110f14f7..b46de3f4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -633,6 +633,7 @@ IF(SYSTEM_ZSTD MATCHES "OFF") ELSE() ProcessPackage(LIBZSTD LIBRARY zstd INCLUDE zstd.h ROOT ${LIBZSTD_ROOT_DIR} MODULES zstd) + ADD_DEFINITIONS(-DSYS_ZSTD) ENDIF() IF(ENABLE_SNOWBALL MATCHES "ON") ADD_SUBDIRECTORY(contrib/snowball) diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index 9a2e7f88d..f9f337864 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -19,7 +19,12 @@ #include "libserver/http/http_private.h" #include "libserver/protocol_internal.h" #include "unix-std.h" -#include "contrib/zstd/zstd.h" + +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# include "contrib/zstd/zstd.h" +#endif #ifdef HAVE_FETCH_H #include <fetch.h> diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 98e409d0f..d846153b8 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -36,8 +36,12 @@ #include "contrib/libottery/ottery.h" #include "contrib/fastutf8/fastutf8.h" -#define ZSTD_STATIC_LINKING_ONLY -#include "contrib/zstd/zstd.h" +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# define ZSTD_STATIC_LINKING_ONLY +# include "contrib/zstd/zstd.h" +#endif #ifdef HAVE_OPENSSL #include <openssl/rand.h> diff --git a/src/libserver/maps/map.c b/src/libserver/maps/map.c index bc53ca538..f324f9d70 100644 --- a/src/libserver/maps/map.c +++ b/src/libserver/maps/map.c @@ -23,10 +23,15 @@ #include "libserver/http/http_connection.h" #include "libserver/http/http_private.h" #include "rspamd.h" -#include "contrib/zstd/zstd.h" #include "contrib/libev/ev.h" #include "contrib/uthash/utlist.h" +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# include "contrib/zstd/zstd.h" +#endif + #undef MAP_DEBUG_REFS #ifdef MAP_DEBUG_REFS #define MAP_RETAIN(x, t) do { \ diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index e7f4dbd50..6e97068a6 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -21,7 +21,6 @@ #include "worker_private.h" #include "libserver/cfg_file_private.h" #include "libmime/scan_result_private.h" -#include "contrib/zstd/zstd.h" #include "lua/lua_common.h" #include "unix-std.h" #include "protocol_internal.h" @@ -30,6 +29,12 @@ #include "task.h" #include <math.h> +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# include "contrib/zstd/zstd.h" +#endif + INIT_LOG_MODULE(protocol) #define msg_err_protocol(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \ diff --git a/src/libserver/task.c b/src/libserver/task.c index 407f2c4d4..aae374c21 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -25,7 +25,6 @@ #include "stat_api.h" #include "unix-std.h" #include "utlist.h" -#include "contrib/zstd/zstd.h" #include "libserver/mempool_vars_internal.h" #include "libserver/cfg_file_private.h" #include "libmime/lang_detection.h" @@ -41,6 +40,12 @@ #include <math.h> +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# include "contrib/zstd/zstd.h" +#endif + __KHASH_IMPL (rspamd_req_headers_hash, static inline, rspamd_ftok_t *, struct rspamd_request_header_chain *, 1, rspamd_ftok_icase_hash, rspamd_ftok_icase_equal) @@ -1981,4 +1986,4 @@ rspamd_worker_guard_handler (EV_P_ ev_io *w, int revents) return; } } -}
\ No newline at end of file +} diff --git a/src/lua/lua_compress.c b/src/lua/lua_compress.c index 5bebd0e0d..599a796e0 100644 --- a/src/lua/lua_compress.c +++ b/src/lua/lua_compress.c @@ -16,10 +16,16 @@ #include "lua_common.h" #include "unix-std.h" -#include "contrib/zstd/zstd.h" -#include "contrib/zstd/error_public.h" #include <zlib.h> +#ifdef SYS_ZSTD +# include "zstd.h" +# include "zstd_errors.h" +#else +# include "contrib/zstd/zstd.h" +# include "contrib/zstd/error_public.h" +#endif + /*** * @module rspamd_compress * This module contains compression/decompression routines (zstd and zlib currently) @@ -614,4 +620,4 @@ luaopen_compress (lua_State *L) lua_pop (L, 2); rspamd_lua_add_preload (L, "rspamd_zstd", lua_load_zstd); -}
\ No newline at end of file +} diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index f5bc5f68e..267760c03 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -36,7 +36,6 @@ #include "libserver/milter.h" #include "libserver/milter_internal.h" #include "libmime/lang_detection.h" -#include "contrib/zstd/zstd.h" #include <math.h> @@ -44,6 +43,12 @@ #include <netinet/tcp.h> /* for TCP_NODELAY */ #endif +#ifdef SYS_ZSTD +# include "zstd.h" +#else +# include "contrib/zstd/zstd.h" +#endif + /* Rotate keys each minute by default */ #define DEFAULT_ROTATION_TIME 60.0 #define DEFAULT_RETRIES 5 |