mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Pass ScriptResult by const reference instead of copying. #1834
This commit is contained in:
@@ -512,11 +512,11 @@ std::string protect_xml(const std::string s) {
|
|||||||
|
|
||||||
/* This is a helper function to determine the ordering of the script results
|
/* This is a helper function to determine the ordering of the script results
|
||||||
based on their id. */
|
based on their id. */
|
||||||
static bool scriptid_lessthan(ScriptResult a, ScriptResult b) {
|
static bool scriptid_lessthan(const ScriptResult &a, const ScriptResult &b) {
|
||||||
return strcmp(a.get_id(), b.get_id()) < 0;
|
return strcmp(a.get_id(), b.get_id()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *formatScriptOutput(ScriptResult sr) {
|
static char *formatScriptOutput(const ScriptResult &sr) {
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
|
|
||||||
std::string c_output;
|
std::string c_output;
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ void PortList::setServiceProbeResults(u16 portno, int protocol,
|
|||||||
|
|
||||||
|
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
void PortList::addScriptResult(u16 portno, int protocol, ScriptResult& sr) {
|
void PortList::addScriptResult(u16 portno, int protocol, const ScriptResult& sr) {
|
||||||
Port *port;
|
Port *port;
|
||||||
|
|
||||||
port = createPort(portno, protocol);
|
port = createPort(portno, protocol);
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ class PortList {
|
|||||||
void getServiceDeductions(u16 portno, int protocol, struct serviceDeductions *sd) const;
|
void getServiceDeductions(u16 portno, int protocol, struct serviceDeductions *sd) const;
|
||||||
|
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
void addScriptResult(u16 portno, int protocol, ScriptResult& sr);
|
void addScriptResult(u16 portno, int protocol, const ScriptResult& sr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Cycles through the 0 or more "ignored" ports which should be
|
/* Cycles through the 0 or more "ignored" ports which should be
|
||||||
|
|||||||
Reference in New Issue
Block a user