1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Clean up string concatenations

Building a string with var = var .. "something" has miserable time
complexities. This commit cleans up a lot of that in scripts, focusing
on packing of data with bin.pack and concatenations within loops.
Additionally, a few instances were replaced with string.rep
This commit is contained in:
dmiller
2015-02-25 19:58:42 +00:00
parent ddb3905b20
commit 10dce0382c
26 changed files with 174 additions and 205 deletions

View File

@@ -375,13 +375,13 @@ local function postaction()
for key, hosts in pairs(hostkeys) do
if #hostkeys[key] > 1 then
table.sort(hostkeys[key], function(a, b) return ipOps.compare_ip(a, "lt", b) end)
local str = 'Key ' .. key .. ' used by:'
local str = {'Key ' .. key .. ' used by:'}
local tab = {key=revmap[key], hosts={}}
for _, host in ipairs(hostkeys[key]) do
str = str .. '\n ' .. host
str[#str+1] = host
table.insert(tab.hosts, host)
end
table.insert(output, str)
table.insert(output, table.concat(str, "\n "))
table.insert(output_tab, tab)
end
end