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

Minor optimization for probe list iteration

This commit is contained in:
dmiller
2024-02-26 18:29:11 +00:00
parent 3cf82912ce
commit 35939b1175

View File

@@ -629,7 +629,7 @@ bool HostScanStats::sendOK(struct timeval *when) const {
puts now in when. */ puts now in when. */
bool HostScanStats::nextTimeout(struct timeval *when) const { bool HostScanStats::nextTimeout(struct timeval *when) const {
struct timeval earliest_to = USI->now; struct timeval earliest_to = USI->now;
std::list<UltraProbe *>::const_iterator probeI; std::list<UltraProbe *>::const_iterator probeI, endI;
bool pending_probes = false; bool pending_probes = false;
assert(when); assert(when);
@@ -637,8 +637,8 @@ bool HostScanStats::nextTimeout(struct timeval *when) const {
/* For any given invocation, the probe timeout is the same for all probes, so /* For any given invocation, the probe timeout is the same for all probes, so
* we can get the earliest-sent probe and then add the timeout to that. * we can get the earliest-sent probe and then add the timeout to that.
*/ */
for (probeI = probes_outstanding.begin(); probeI != probes_outstanding.end(); for (probeI = probes_outstanding.begin(), endI = probes_outstanding.end();
probeI++) { probeI != endI; probeI++) {
UltraProbe *probe = *probeI; UltraProbe *probe = *probeI;
if (!probe->timedout) { if (!probe->timedout) {
pending_probes = true; pending_probes = true;