Date: Tue, 28 Apr 2020 01:39:34 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360420 - head/stand/lua Message-ID: <202004280139.03S1dYCG045877@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Tue Apr 28 01:39:34 2020 New Revision: 360420 URL: https://svnweb.freebsd.org/changeset/base/360420 Log: lualoader config: don't call loader.getenv() as much We don't actually need to fetch loader_conf_files as much as we do; we've already fetched it once at the beginning, we only really need to fetch it again after each file we've processed. If it changes, then we can stash that off into our local prefiles. While here, drop a note about the recursion so that I stop trying to change it. It may very well make redundant some of the work we're doing, but that's OK. MFC after: 3 days Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Apr 28 00:44:05 2020 (r360419) +++ head/stand/lua/config.lua Tue Apr 28 01:39:34 2020 (r360420) @@ -343,13 +343,12 @@ end local function readConfFiles(loaded_files) local f = loader.getenv("loader_conf_files") if f ~= nil then + local prefiles = f for name in f:gmatch("([%w%p]+)%s*") do if loaded_files[name] ~= nil then goto continue end - local prefiles = loader.getenv("loader_conf_files") - print("Loading " .. name) -- These may or may not exist, and that's ok. Do a -- silent parse so that we complain on parse errors but @@ -361,7 +360,12 @@ local function readConfFiles(loaded_files) loaded_files[name] = true local newfiles = loader.getenv("loader_conf_files") if prefiles ~= newfiles then + -- Recurse; process the new files immediately. + -- If we come back and it turns out we've + -- already loaded the rest of what was in the + -- original loader_conf_files, no big deal. readConfFiles(loaded_files) + prefiles = newfiles end ::continue:: end
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004280139.03S1dYCG045877>