aboutsummaryrefslogtreecommitdiff
path: root/stand/lua
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-04-28 01:39:34 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-04-28 01:39:34 +0000
commitecacf5ff1eb4be4b56a0014cf808a569ce733651 (patch)
tree3753338c4e5afb493ca4cdcde0b733c67c1de642 /stand/lua
parentb8040914bf6461dfe3ca5fadc341cbbb27e85abc (diff)
downloadsrc-ecacf5ff1eb4be4b56a0014cf808a569ce733651.tar.gz
src-ecacf5ff1eb4be4b56a0014cf808a569ce733651.zip
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
Notes
Notes: svn path=/head/; revision=360420
Diffstat (limited to 'stand/lua')
-rw-r--r--stand/lua/config.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index cbf498663f83..5a3a12d4a29f 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -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