commit bf798c5: [Minor] Add method to check hyperscan support to multipattern library

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 24 20:49:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-24 16:34:14 +0000
URL: https://github.com/rspamd/rspamd/commit/bf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6

[Minor] Add method to check hyperscan support to multipattern library

---
 src/lua/lua_trie.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c
index a1b0de118..3941a5a85 100644
--- a/src/lua/lua_trie.c
+++ b/src/lua/lua_trie.c
@@ -39,6 +39,7 @@ trie:match('some big text', trie_callback)
 
 /* Suffix trie */
 LUA_FUNCTION_DEF (trie, create);
+LUA_FUNCTION_DEF (trie, has_hyperscan);
 LUA_FUNCTION_DEF (trie, match);
 LUA_FUNCTION_DEF (trie, search_mime);
 LUA_FUNCTION_DEF (trie, search_rawmsg);
@@ -56,6 +57,7 @@ static const struct luaL_reg trielib_m[] = {
 };
 static const struct luaL_reg trielib_f[] = {
 	LUA_INTERFACE_DEF (trie, create),
+	LUA_INTERFACE_DEF (trie, has_hyperscan),
 	{NULL, NULL}
 };
 
@@ -80,6 +82,19 @@ lua_trie_destroy (lua_State *L)
 	return 0;
 }
 
+/***
+ * function trie.has_hyperscan()
+ * Checks for hyperscan support
+ *
+ * @return {bool} true if hyperscan is supported
+ */
+static gint
+lua_trie_has_hyperscan (lua_State *L)
+{
+	lua_pushboolean (L, rspamd_multipattern_has_hyperscan ());
+	return 1;
+}
+
 /***
  * function trie.create(patterns, [flags])
  * Creates new trie data structure


More information about the Commits mailing list