changeset 14056:5b4efb5b798a 13.0

prosody: Move function only used once into block where it is used So it is not even instantiated when not used, for whatever tiny performance gain
author Kim Alvefur <zash@zash.se>
date Sun, 01 Feb 2026 15:21:40 +0100
parents f47b4baa7934
children 312542dd184d
files prosody prosodyctl
diffstat 2 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Sun Feb 01 15:18:14 2026 +0100
+++ b/prosody	Sun Feb 01 15:21:40 2026 +0100
@@ -25,14 +25,13 @@
 	return os.exit(1);
 end
 
-local function is_relative(path)
-	local path_sep = package.config:sub(1,1);
-	return ((path_sep == "/" and path:sub(1,1) ~= "/")
-		or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
-end
-
 -- Tell Lua where to find our libraries
 if CFG_SOURCEDIR then
+	local function is_relative(path)
+		local path_sep = package.config:sub(1,1);
+		return ((path_sep == "/" and path:sub(1,1) ~= "/")
+			or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
+	end
 	local function filter_relative_paths(path)
 		if is_relative(path) then return ""; end
 	end
--- a/prosodyctl	Sun Feb 01 15:18:14 2026 +0100
+++ b/prosodyctl	Sun Feb 01 15:21:40 2026 +0100
@@ -24,14 +24,14 @@
 	return os.exit(1);
 end
 
-local function is_relative(path)
-	local path_sep = package.config:sub(1,1);
-	return ((path_sep == "/" and path:sub(1,1) ~= "/")
-		or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
-end
 
 -- Tell Lua where to find our libraries
 if CFG_SOURCEDIR then
+	local function is_relative(path)
+		local path_sep = package.config:sub(1,1);
+		return ((path_sep == "/" and path:sub(1,1) ~= "/")
+			or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
+	end
 	local function filter_relative_paths(path)
 		if is_relative(path) then return ""; end
 	end