util.jid: Remove redundant check from split() (micro-optimization?)
authorMatthew Wild <mwild1@gmail.com>
Tue, 11 Oct 2022 13:33:19 +0100
changeset 12772 6e3aa3995eab
parent 12771 3b75943fa5c1
child 12773 27e1d4354274
util.jid: Remove redundant check from split() (micro-optimization?)
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