mirror of
https://github.com/nmap/nmap.git
synced 2026-08-27 03:48:14 +00:00
Consolidate "contains" functions into stdnse.contains
These implementations were all functionally identical. The replacement has an extra feature of returning the index where the value was found, currently unused.
This commit is contained in:
parent
197f28265f
commit
726b259b20
9 changed files with 28 additions and 109 deletions
|
|
@ -122,21 +122,11 @@ action = function(host, port)
|
|||
return #output > 0 and stdnse.strjoin("\n", output) or nil
|
||||
end
|
||||
|
||||
local function contains(t, elem)
|
||||
local _, e
|
||||
for _, e in ipairs(t) do
|
||||
if e == elem then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function filter_out(t, filter)
|
||||
local result = {}
|
||||
local _, e, f
|
||||
for _, e in ipairs(t) do
|
||||
if not contains(filter, e) then
|
||||
if not stdnse.contains(filter, e) then
|
||||
result[#result + 1] = e
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue