1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 07:29:01 +00:00

String concat cleanup grab-bag

Mostly just eliminating concatenation-reassignments by chaining
concatenations, reordering assignments to allow better use of bin.pack,
and using tables to store intermediate results before concatenating
them. Used strbuf as a quick fix in dhcp.lua. Eliminated some unused
string variables in vulns.lua.
This commit is contained in:
dmiller
2015-03-02 14:39:29 +00:00
parent c1b2429efd
commit 03110e7e89
13 changed files with 57 additions and 82 deletions

View File

@@ -553,12 +553,11 @@ JavaField = {
getValue = function( self ) return self.value end,
__tostring = function( self )
local data = tostring(self.type) .. " " .. tostring(self.name)
if self.value ~= nil then
data = data .." = " .. tostring(self.value)
return string.format("%s %s = %s", self.type, self.name, self.value)
else
return string.format("%s %s", self.type, self.name)
end
return data
end,
toTable = function(self)
local data = {tostring(self.type) .. " " .. tostring(self.name)}
@@ -571,8 +570,7 @@ JavaField = {
table.insert(data, self.value)
end
else
--TODO: FIXME This is illegal, but I don't know what the intent was:
data = data .." = " .. tostring(self.value) --FIXME
table.insert(data, self.value)
end
end
return data