aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-11-23 16:30:34 +0000
committerMatthew Wild <mwild1@gmail.com>2009-11-23 16:30:34 +0000
commit53979a7de7baea48ede8b2a45a58127ac645d86b (patch)
treec8914591d00ee172a3ea736513271afaecc75a08
parent119d80071d6c91ed7d91237c6a7f9711adde8759 (diff)
parent82c595c85bd5ea8bf9dc116e3e1b9f01a56f8619 (diff)
downloadprosody-53979a7de7baea48ede8b2a45a58127ac645d86b.tar.gz
prosody-53979a7de7baea48ede8b2a45a58127ac645d86b.zip
Merge with trunk
-rwxr-xr-xprosody8
-rw-r--r--util/serialization.lua31
2 files changed, 22 insertions, 17 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
diff --git a/util/serialization.lua b/util/serialization.lua
index c2bbbb8d..07a099c9 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