diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-11 11:02:17 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-11 11:02:17 +0100 |
commit | 656d08ac253b6fb85a3b3671a47c3b70fcbdf749 (patch) | |
tree | a5db04bd7d739792446e3590cbfe871693c5a6af /lualib/lua_selectors.lua | |
parent | e0d362c7f25718abd881c90b163945d4b7b80fe1 (diff) | |
download | rspamd-656d08ac253b6fb85a3b3671a47c3b70fcbdf749.tar.gz rspamd-656d08ac253b6fb85a3b3671a47c3b70fcbdf749.zip |
[Minor] Use shallowcopy from lua_util
Diffstat (limited to 'lualib/lua_selectors.lua')
-rw-r--r-- | lualib/lua_selectors.lua | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index d1ef91230..112443fd3 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -536,19 +536,6 @@ exports.parse_selector = function(cfg, str) local output = {} if not parsed then return nil end - local function shallowcopy(orig) - local orig_type = type(orig) - local copy - if orig_type == 'table' then - copy = {} - for orig_key, orig_value in pairs(orig) do - copy[orig_key] = orig_value - end - else - copy = orig - end - return copy - end -- Output AST format is the following: -- table of individual selectors @@ -570,7 +557,7 @@ exports.parse_selector = function(cfg, str) return nil end - res.selector = shallowcopy(extractors[selector_tbl[1]]) + res.selector = lua_util.shallowcopy(extractors[selector_tbl[1]]) res.selector.name = selector_tbl[1] res.selector.args = selector_tbl[2] or {} @@ -585,7 +572,7 @@ exports.parse_selector = function(cfg, str) logger.errx(cfg, 'processor %s is unknown', proc_name) return nil end - local processor = shallowcopy(transform_function[proc_name]) + local processor = lua_util.shallowcopy(transform_function[proc_name]) processor.name = proc_name processor.args = proc_tbl[2] lua_util.debugm(M, cfg, 'attached processor %s to selector %s, args: %s', |