# HG changeset patch # User Kim Alvefur # Date 1411429456 -7200 # Node ID 1c78f10f05d0293d8ba08cd32e1355c41cb09843 # Parent 84b332eacde902f41452035e9a9becf14bc1dba5# Parent 6d4d87a89026bf785cc6a974f5a2138433f52da3 Merge 0.10->trunk diff -r 84b332eacde9 -r 1c78f10f05d0 core/moduleapi.lua --- a/core/moduleapi.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/core/moduleapi.lua Tue Sep 23 01:44:16 2014 +0200 @@ -390,7 +390,9 @@ return require"core.storagemanager".open(self.host, name or self.name, type); end -return function (mm) +function api.init(mm) modulemanager = mm; return api; end + +return api; diff -r 84b332eacde9 -r 1c78f10f05d0 core/modulemanager.lua --- a/core/modulemanager.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/core/modulemanager.lua Tue Sep 23 01:44:16 2014 +0200 @@ -37,7 +37,7 @@ module "modulemanager" -local api = _G.require "core.moduleapi"(_M); -- Module API container +local api = _G.require "core.moduleapi".init(_M); -- Module API container -- [host] = { [module] = module_env } local modulemap = { ["*"] = {} }; diff -r 84b332eacde9 -r 1c78f10f05d0 util/random.lua --- a/util/random.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/util/random.lua Tue Sep 23 01:44:16 2014 +0200 @@ -10,7 +10,7 @@ local os_time = os.time; local os_clock = os.clock; local ceil = math.ceil; -local sha1 = require "util.hashes".sha1; +local H = require "util.hashes".sha512; local last_uniq_time = 0; local function uniq_time() @@ -21,7 +21,7 @@ end local function new_random(x) - return sha1(x..os_clock()..tostring({})); + return H(x..os_clock()..tostring({})); end local buffer = new_random(uniq_time()); @@ -31,8 +31,8 @@ end local function bytes(n) - if #buffer < n then seed(uniq_time()); end - local r = buffer:sub(0, n); + if #buffer < n+4 then seed(uniq_time()); end + local r = buffer:sub(1, n); buffer = buffer:sub(n+1); return r; end