# HG changeset patch # User Matthew Wild # Date 1665491599 -3600 # Node ID 6e3aa3995eab6532b00e06b37f8d8502caf0629a # Parent 3b75943fa5c1edc25069a05fc3d03c3b838c3143 util.jid: Remove redundant check from split() (micro-optimization?) diff -r 3b75943fa5c1 -r 6e3aa3995eab util/jid.lua --- a/util/jid.lua Tue Oct 11 13:31:47 2022 +0100 +++ b/util/jid.lua Tue Oct 11 13:33:19 2022 +0100 @@ -35,8 +35,7 @@ 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