diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-02-28 20:25:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 20:25:39 +0000 |
commit | dc4d83ffa2d24135efff45647121bcb27449acfb (patch) | |
tree | b1b837a54872d8898cd9d26c02a01dfb68e3a293 /lualib | |
parent | 9a6ee04f0d351f82fbba65446e8318c8fe188117 (diff) | |
parent | 431b3b892f0dd29581406dcc4ed690358d5780ca (diff) | |
download | rspamd-dc4d83ffa2d24135efff45647121bcb27449acfb.tar.gz rspamd-dc4d83ffa2d24135efff45647121bcb27449acfb.zip |
Merge pull request #4093 from citrin/str_endswith
[Minor] Microoptimize lua_util.str_endswith
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_util.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 308663399..7cabeed2d 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -113,7 +113,7 @@ end -- @return {boolean} true if text ends with the specified suffix, false otherwise --]] exports.str_endswith = function(s, suffix) - return s:sub(-suffix:len()) == suffix + return s:find(suffix, -suffix:len(), true) ~= nil end --[[[ |