From: Vsevolod Stakhov Date: Mon, 27 Mar 2017 09:07:51 +0000 (+0100) Subject: [Minor] One more memoization fix X-Git-Tag: 1.5.4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8aff44f70d7d477cade15d96caa378416462d20;p=thirdparty%2Frspamd.git [Minor] One more memoization fix --- diff --git a/src/plugins/lua/phishing.lua b/src/plugins/lua/phishing.lua index d248c75136..74909e9da1 100644 --- a/src/plugins/lua/phishing.lua +++ b/src/plugins/lua/phishing.lua @@ -239,17 +239,12 @@ local function phishing_map(mapname, phishmap, id) end end -local lpeg_grammar local function rspamd_str_split_fun(s, sep, func) local lpeg = require "lpeg" - - if not lpeg_grammar then - sep = lpeg.P(sep) - local elem = lpeg.C((1 - sep)^0 / func) - local p = lpeg.C(elem * (sep * elem)^0) -- make a table capture - lpeg_grammar = p - end - return lpeg.match(lpeg_grammar, s) + sep = lpeg.P(sep) + local elem = lpeg.C((1 - sep)^0 / func) + local p = lpeg.C(elem * (sep * elem)^0) -- make a table capture + return p:match(s) end local function insert_url_from_string(pool, tbl, str, data)