aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-17 03:26:21 +0200
committerKim Alvefur <zash@zash.se>2017-04-17 03:26:21 +0200
commit193ed93b1c8c8bd4024baa2697cbb8efe7ec3bc1 (patch)
tree21f7c1f911c03f692a641e940c1994e639c5a129
parent794f85abf55cb08c53ae0f65e3068545d22e450e (diff)
downloadprosody-193ed93b1c8c8bd4024baa2697cbb8efe7ec3bc1.tar.gz
prosody-193ed93b1c8c8bd4024baa2697cbb8efe7ec3bc1.zip
util.datamanager: Use already known index instead of measuring length each iteration
-rw-r--r--util/datamanager.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 6edf7ac0..bd8fb7bb 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -268,8 +268,8 @@ local function list_store(username, host, datastore, data)
if callback(username, host, datastore) == false then return true; end
-- save the datastore
local d = {};
- for _, item in ipairs(data) do
- d[#d+1] = "item(" .. serialize(item) .. ");\n";
+ for i, item in ipairs(data) do
+ d[i] = "item(" .. serialize(item) .. ");\n";
end
local ok, msg = atomic_store(getpath(username, host, datastore, "list", true), t_concat(d));
if not ok then