commit 65ba2f3: [Minor] Fix build with old hyperscan...

Vsevolod Stakhov vsevolod at rspamd.com
Sun Mar 5 19:56:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-03-05 19:54:31 +0000
URL: https://github.com/rspamd/rspamd/commit/65ba2f310d6475d0a829e6c036acba6f68496b3b (HEAD -> master)

[Minor] Fix build with old hyperscan...

---
 src/libserver/hyperscan_tools.cxx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libserver/hyperscan_tools.cxx b/src/libserver/hyperscan_tools.cxx
index 574813841..05da04c40 100644
--- a/src/libserver/hyperscan_tools.cxx
+++ b/src/libserver/hyperscan_tools.cxx
@@ -41,10 +41,13 @@
 // failing at `hs_alloc_scratch` phase or even `hs_scan` which is **way too late**
 // Hence, we have to check hyperscan internal guts to prevent that situation...
 
+#ifdef HS_MAJOR
 #ifndef HS_VERSION_32BIT
 #define HS_VERSION_32BIT ((HS_MAJOR << 24) | (HS_MINOR << 16) | (HS_PATCH << 8) | 0)
 #endif
-#ifndef HS_DB_VERSION
+#endif // defined(HS_MAJOR)
+
+#if !defined(HS_DB_VERSION) && defined(HS_VERSION_32BIT)
 #define HS_DB_VERSION HS_VERSION_32BIT
 #endif
 
@@ -353,10 +356,12 @@ hs_is_valid_database(void *raw, std::size_t len, std::string_view fname) -> tl::
 			fname, test.magic, HS_DB_MAGIC));
 	}
 
+#ifdef HS_DB_VERSION
 	if (test.version != HS_DB_VERSION) {
 		return tl::make_unexpected(fmt::format("cannot load hyperscan database from {}: invalid version: {} ({} expected)",
 			fname, test.version, HS_DB_VERSION));
 	}
+#endif
 
 	return true;
 }


More information about the Commits mailing list