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

Remove useless calls to string.format

stdnse.print_debug accepts a format string and arguments, making
string.format redundant in calls of this form:

stdnse.print_debug(1, string.format("%s: error", SCRIPT_NAME))
stdnse.print_debug(("length %d"):format(#tab))

These can be rewritten as:

stdnse.print_debug(1, "%s: error", SCRIPT_NAME)
stdnse.print_debug("length %d", #tab)
This commit is contained in:
dmiller
2014-02-13 15:47:41 +00:00
parent b73c3aa60f
commit a084340b6d
27 changed files with 440 additions and 430 deletions

View File

@@ -98,7 +98,7 @@ local create_tftp_file_request = function(filename)
end
local check_file_present = function(host, port, filename)
stdnse.print_debug(1, ("checking file %s"):format(filename))
stdnse.print_debug(1, "checking file %s", filename)
local file_request = create_tftp_file_request(filename)
@@ -109,14 +109,14 @@ local check_file_present = function(host, port, filename)
if (not (status)) then
stdnse.print_debug(1, ("error %s"):format(lhost))
stdnse.print_debug(1, "error %s", lhost)
socket:close()
return REQUEST_ERROR
end
local bind_socket = nmap.new_socket("udp")
stdnse.print_debug(1, ("local port = %d"):format(lport))
stdnse.print_debug(1, "local port = %d", lport)
socket:send(file_request)
socket:close()
@@ -127,7 +127,7 @@ local check_file_present = function(host, port, filename)
stdnse.print_debug(1, "starting listener")
if (not (bindOK)) then
stdnse.print_debug(1, ("Error in bind %s"):format(error))
stdnse.print_debug(1, "Error in bind %s", error)
bind_socket:close()
return REQUEST_ERROR
end
@@ -136,7 +136,7 @@ local check_file_present = function(host, port, filename)
local recvOK, data = bind_socket:receive()
if (not (recvOK)) then
stdnse.print_debug(1, ("Error in receive %s"):format(data))
stdnse.print_debug(1, "Error in receive %s", data)
bind_socket:close()
return REQUEST_ERROR
end