1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Replace chained concatenation reassignment with simple concatenation

Example:

x = y
x = x .. z

Fixed:

x = y
.. z

This simple fix would save 1 string creation/deletion. Most changes
involve many more than this.
This commit is contained in:
dmiller
2015-03-02 13:47:42 +00:00
parent 3025022f98
commit ea58c6bebb
12 changed files with 235 additions and 260 deletions

View File

@@ -98,15 +98,17 @@ OSPF = {
end,
__tostring = function(self)
local hdr = bin.pack(">CCS", self.ver, self.type, self.length )
hdr = hdr .. bin.pack(">IISS", ipOps.todword(self.router_id), self.area_id, self.chksum, self.auth_type)
local auth
if self.auth_type == 0x00 then
hdr = hdr .. bin.pack(">L", 0x00)
auth = bin.pack(">L", 0x00)
elseif self.auth_type == 0x01 then
hdr = hdr .. bin.pack(">A8", self.auth_data.password)
auth = bin.pack(">A8", self.auth_data.password)
elseif self.auth_type == 0x02 then
hdr = hdr .. bin.pack(">A".. self.auth_data.length, self.auth_data.hash)
auth = bin.pack(">A".. self.auth_data.length, self.auth_data.hash)
end
local hdr = bin.pack(">CCS", self.ver, self.type, self.length )
.. bin.pack(">IISS", ipOps.todword(self.router_id), self.area_id, self.chksum, self.auth_type)
.. auth
return hdr
end,