From 6ae850c963db802a606b2fd11d670e599a43626f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 11 Oct 2022 13:33:19 +0100 Subject: util.jid: Remove redundant check from split() (micro-optimization?) --- util/jid.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'util') 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 -- cgit v1.2.3