From 3f95c8572ce3c94b1ac4f2040ed803efbe974308 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Mon, 23 Nov 2009 08:55:27 +0500 Subject: Mainfile: Fixed some comments. --- prosody | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prosody b/prosody index ae9cd2fc..8dd37f30 100755 --- a/prosody +++ b/prosody @@ -14,7 +14,7 @@ CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); CFG_PLUGINDIR=os.getenv("PROSODY_PLUGINDIR"); CFG_DATADIR=os.getenv("PROSODY_DATADIR"); --- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- -- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- if CFG_SOURCEDIR then package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; @@ -82,13 +82,13 @@ function read_config() end function load_libraries() - --- Initialize logging + -- Initialize logging require "core.loggingmanager" - --- Check runtime dependencies + -- Check runtime dependencies require "util.dependencies" - --- Load socket framework + -- Load socket framework server = require "net.server" end -- cgit v1.2.3 From 8d13f90bed046737e1c005ed837ec09c95192d57 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Mon, 23 Nov 2009 19:35:24 +0500 Subject: util.serialization: Concise output for empty tables. --- util/serialization.lua | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/util/serialization.lua b/util/serialization.lua index c2bbbb8d..2a1fad02 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -13,6 +13,7 @@ local t_insert = table.insert; local t_concat = table.concat; local error = error; local pairs = pairs; +local next = next; local debug_traceback = debug.traceback; local log = require "util.logger".init("serialization"); @@ -34,21 +35,25 @@ local function _simplesave(o, ind, t, func) elseif type(o) == "string" then func(t, (("%q"):format(o):gsub("\\\n", "\\n"))); elseif type(o) == "table" then - func(t, "{\n"); - for k,v in pairs(o) do - func(t, indent(ind)); - func(t, "["); - func(t, basicSerialize(k)); - func(t, "] = "); - if ind == 0 then - _simplesave(v, 0, t, func); - else - _simplesave(v, ind+1, t, func); + if next(o) then + func(t, "{\n"); + for k,v in pairs(o) do + func(t, indent(ind)); + func(t, "["); + func(t, basicSerialize(k)); + func(t, "] = "); + if ind == 0 then + _simplesave(v, 0, t, func); + else + _simplesave(v, ind+1, t, func); + end + func(t, ",\n"); end - func(t, ",\n"); + func(t, indent(ind-1)); + func(t, "}"); + else + func(t, "{}"); end - func(t, indent(ind-1)); - func(t, "}"); elseif type(o) == "boolean" then func(t, (o and "true" or "false")); else -- cgit v1.2.3 From 5b41760cecdfd2db66b84ce92454dd61e7f1341b Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Mon, 23 Nov 2009 19:50:04 +0500 Subject: util.serialization: Replaced commas with semi-colons between table fields. --- util/serialization.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/serialization.lua b/util/serialization.lua index 2a1fad02..07a099c9 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -47,7 +47,7 @@ local function _simplesave(o, ind, t, func) else _simplesave(v, ind+1, t, func); end - func(t, ",\n"); + func(t, ";\n"); end func(t, indent(ind-1)); func(t, "}"); -- cgit v1.2.3