aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-10-11 13:33:19 +0100
committerMatthew Wild <mwild1@gmail.com>2022-10-11 13:33:19 +0100
commit6ae850c963db802a606b2fd11d670e599a43626f (patch)
tree2d7ad596b2ab44ad40f3559adb9781119936361e
parente8d1a6720e4997baa9585c96078712bed2512dbb (diff)
downloadprosody-6ae850c963db802a606b2fd11d670e599a43626f.tar.gz
prosody-6ae850c963db802a606b2fd11d670e599a43626f.zip
util.jid: Remove redundant check from split() (micro-optimization?)
-rw-r--r--util/jid.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/util/jid.lua b/util/jid.lua
index 759af746..3e1336fc 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -35,8 +35,7 @@ local function split(jid)
if jid == nil then return; end
local node, nodepos = match(jid, "^([^@/]+)@()");
local host, hostpos = match(jid, "^([^@/]+)()", nodepos);
- if node ~= nil and host == nil then return nil, nil, nil; end
- local resource = match(jid, "^/(.+)$", hostpos);
+ local resource = host and match(jid, "^/(.+)$", hostpos);
if (host == nil) or ((resource == nil) and #jid >= hostpos) then return nil, nil, nil; end
return node, host, resource;
end