diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-07-25 15:21:04 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-07-25 15:21:04 +0000 |
commit | db15e1c2f2049c0c59812ed51a4b6be3228b2097 (patch) | |
tree | 4fd272d33b20eb9ea7e67c21795c65b9b5300ec0 | |
parent | dfa9088c324e296ca7f1bbb19485213584c723f6 (diff) |
make list() a little bit faster and really rm docdirs from the -s search
git-svn-id: svn://tug.org/texlive/trunk@9767 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/texdoc.tlu | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/Master/texmf/scripts/texlive/texdoc.tlu b/Master/texmf/scripts/texlive/texdoc.tlu index 4c9e4290268..2ac6cffcdbf 100755 --- a/Master/texmf/scripts/texlive/texdoc.tlu +++ b/Master/texmf/scripts/texlive/texdoc.tlu @@ -66,13 +66,15 @@ support_zipped = false -- a general-use function function list (t) local i = 0 - local n = table.getn(t) -- can be slow: is it really usefull? return function () i = i + 1 - if i <= n then return t[i] end + return t[i] end end +-- Remark: we always assume our tables have no hole (that is, no nil value +-- followed by a non-nil value). So we use the simple iterator above, and +-- the # operator sometimes (bit faster than table.getn). -- functions for the search options ----------------------------------- @@ -119,7 +121,7 @@ end --deluaficate function pattern_search (pattern) docfiles = {} -- should not be local (used in recurse_tree) pattern = deluaficate(pattern) - -- populate docdirs and doclines list + -- populate docfiles list for database in get_lsr_files() do local texmf_tree = string.gsub(database,'ls%-R$','') is_docline = false @@ -162,9 +164,6 @@ function recurse_tree (path, pattern) local attr = lfs.attributes (f) if attr then -- else stale symlink if attr.mode == "directory" then - if string.match (f, pattern) then - table.insert(docdirs,f) - end recurse_tree (f, pattern) else if string.match (f, pattern) then @@ -504,15 +503,6 @@ function print_ordered_byext (files_list) end end --- padd number with space in order to get a string of length two -function padd_two (number) - return (number < 10) or number..' ' and number -end - --- print a list of files wit numbers the user can use -function print_menu (files) -end - -- apologize/complain if something went wrong function apologize (reason, name) if reason == 'notfound' then |