aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-10-16 22:37:39 -0300
committerHisham Muhammad <hisham@gobolinux.org>2012-10-16 22:37:39 -0300
commite51efb721935e959b33c6ec9884d2ecbe418fcb2 (patch)
treeef0ad4ae6fc99741a564fa281bb13f4876e5948c
parent0353599bb573254b4a6125a61ff5353b93d78ba3 (diff)
downloadluarocks-e51efb721935e959b33c6ec9884d2ecbe418fcb2.tar.gz
luarocks-e51efb721935e959b33c6ec9884d2ecbe418fcb2.tar.bz2
luarocks-e51efb721935e959b33c6ec9884d2ecbe418fcb2.zip
Remove dead code: search_repos always returns a table.
-rw-r--r--src/luarocks/download.lua2
-rw-r--r--src/luarocks/search.lua11
2 files changed, 3 insertions, 10 deletions
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua
index 474e4d39..ae835bf2 100644
--- a/src/luarocks/download.lua
+++ b/src/luarocks/download.lua
@@ -24,7 +24,7 @@ function download(arch, name, version, all)
24 if arch then query.arch = arch end 24 if arch then query.arch = arch end
25 if all then 25 if all then
26 if name == "" then query.exact_name = false end 26 if name == "" then query.exact_name = false end
27 results, err = search.search_repos(query) 27 results = search.search_repos(query)
28 else 28 else
29 results, err = search.find_suitable_rock(query) 29 results, err = search.find_suitable_rock(query)
30 end 30 end
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua
index 96c6b876..692004ae 100644
--- a/src/luarocks/search.lua
+++ b/src/luarocks/search.lua
@@ -185,10 +185,9 @@ end
185 185
186--- Search on all configured rocks servers. 186--- Search on all configured rocks servers.
187-- @param query table: A dependency query. 187-- @param query table: A dependency query.
188-- @return table or (nil, string): A table where keys are package names 188-- @return table: A table where keys are package names
189-- and values are tables matching version strings to an array of 189-- and values are tables matching version strings to an array of
190-- rocks servers; if no results are found, an empty table is returned. 190-- rocks servers; if no results are found, an empty table is returned.
191-- In case of errors, nil and and error message are returned.
192function search_repos(query) 191function search_repos(query)
193 assert(type(query) == "table") 192 assert(type(query) == "table")
194 193
@@ -269,10 +268,7 @@ end
269function find_suitable_rock(query) 268function find_suitable_rock(query)
270 assert(type(query) == "table") 269 assert(type(query) == "table")
271 270
272 local results, err = search_repos(query) 271 local results = search_repos(query)
273 if not results then
274 return nil, err
275 end
276 local first = next(results) 272 local first = next(results)
277 if not first then 273 if not first then
278 return nil, "No results matching query were found." 274 return nil, "No results matching query were found."
@@ -373,9 +369,6 @@ function run(...)
373 local query = make_query(name:lower(), version) 369 local query = make_query(name:lower(), version)
374 query.exact_name = false 370 query.exact_name = false
375 local results, err = search_repos(query) 371 local results, err = search_repos(query)
376 if not results then
377 return nil, err
378 end
379 util.printout() 372 util.printout()
380 util.printout("Search results:") 373 util.printout("Search results:")
381 util.printout("===============") 374 util.printout("===============")