From bf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 24 Feb 2020 16:34:14 +0000 Subject: [Minor] Add method to check hyperscan support to multipattern library --- src/lua/lua_trie.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lua/lua_trie.c') 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 -- cgit v1.2.3