summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-07-22 22:35:01 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-07-22 22:35:01 +0200
commit1de2387071cd286376d178d385dbedcba5168e5b (patch)
tree72416d6b92097d01d773466db10c020f198e8069
parent3fddf98f1682b7c61b7c5e8543fa0665e38308f8 (diff)
downloadluaotfload-1de2387071cd286376d178d385dbedcba5168e5b.tar.gz
avoid building of intermediate list in file locators
-rw-r--r--luaotfload-database.lua14
1 files changed, 6 insertions, 8 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 70a49ff..7eb0e05 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -175,13 +175,13 @@ find_files_indeed = function (acc, dirs, filter)
local dir = dirs[#dirs]
dirs[#dirs] = nil
- local newdirs, newfiles = { }, { }
+ local newfiles = { }
for ent in lfsdir (dir) do
if ent ~= "." and ent ~= ".." then
local fullpath = dir .. "/" .. ent
if filter (fullpath) == true then
if lfsisdir (fullpath) then
- newdirs[#newdirs+1] = fullpath
+ dirs[#dirs+1] = fullpath
elseif lfsisfile (fullpath) then
newfiles[#newfiles+1] = fullpath
end
@@ -189,8 +189,7 @@ find_files_indeed = function (acc, dirs, filter)
end
end
return find_files_indeed (tableappend (acc, newfiles),
- tableappend (dirs, newdirs),
- filter)
+ dirs, filter)
end
local dummyfilter = function () return true end
@@ -1415,7 +1414,7 @@ process_dir_tree = function (acc, dirs)
local dir = dirs[#dirs]
dirs[#dirs] = nil
- local newdirs, newfiles = { }, { }
+ local newfiles = { }
local blacklist = names.blacklist
for ent in lfsdir (dir) do
--- filter right away
@@ -1424,7 +1423,7 @@ process_dir_tree = function (acc, dirs)
if lfsisdir (fullpath)
and not lpegmatch (p_blacklist, fullpath)
then
- newdirs[#newdirs+1] = fullpath
+ dirs[#dirs+1] = fullpath
elseif lfsisfile (fullpath) then
if lpegmatch (p_font_extensions, stringlower(ent)) then
newfiles[#newfiles+1] = fullpath
@@ -1432,8 +1431,7 @@ process_dir_tree = function (acc, dirs)
end
end
end
- return process_dir_tree (tableappend (acc, newfiles),
- tableappend (dirs, newdirs))
+ return process_dir_tree (tableappend (acc, newfiles),dirs)
end
--- string -> string list