From: Vsevolod Stakhov Date: Mon, 24 Feb 2020 16:34:14 +0000 (+0000) Subject: [Minor] Add method to check hyperscan support to multipattern library X-Git-Tag: 2.4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6;p=thirdparty%2Frspamd.git [Minor] Add method to check hyperscan support to multipattern library --- diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c index a1b0de1189..3941a5a855 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