mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +00:00
Avoid multiple expansions of TIMEVAL_MSEC_SUBTRACT macro within MAX macro
This commit is contained in:
parent
f0fab247db
commit
dcb4ba569e
6 changed files with 23 additions and 11 deletions
|
|
@ -264,8 +264,10 @@ int epoll_loop(struct npool *nsp, int msec_timeout) {
|
|||
nse = next_expirable_event(nsp);
|
||||
if (!nse)
|
||||
event_msecs = -1; /* None of the events specified a timeout */
|
||||
else
|
||||
event_msecs = MAX(0, TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod));
|
||||
else {
|
||||
event_msecs = TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod);
|
||||
event_msecs = MAX(0, event_msecs);
|
||||
}
|
||||
|
||||
#if HAVE_PCAP
|
||||
#ifndef PCAP_CAN_DO_SELECT
|
||||
|
|
|
|||
|
|
@ -300,8 +300,10 @@ int iocp_loop(struct npool *nsp, int msec_timeout) {
|
|||
nse = next_expirable_event(nsp);
|
||||
if (!nse)
|
||||
event_msecs = -1; /* None of the events specified a timeout */
|
||||
else
|
||||
event_msecs = MAX(0, TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod));
|
||||
else {
|
||||
event_msecs = TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod);
|
||||
event_msecs = MAX(0, event_msecs);
|
||||
}
|
||||
|
||||
#if HAVE_PCAP
|
||||
#ifndef PCAP_CAN_DO_SELECT
|
||||
|
|
|
|||
|
|
@ -242,8 +242,10 @@ int kqueue_loop(struct npool *nsp, int msec_timeout) {
|
|||
nse = next_expirable_event(nsp);
|
||||
if (!nse)
|
||||
event_msecs = -1; /* None of the events specified a timeout */
|
||||
else
|
||||
event_msecs = MAX(0, TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod));
|
||||
else {
|
||||
event_msecs = TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod);
|
||||
event_msecs = MAX(0, event_msecs);
|
||||
}
|
||||
|
||||
#if HAVE_PCAP
|
||||
#ifndef PCAP_CAN_DO_SELECT
|
||||
|
|
|
|||
|
|
@ -314,8 +314,10 @@ int poll_loop(struct npool *nsp, int msec_timeout) {
|
|||
nse = next_expirable_event(nsp);
|
||||
if (!nse)
|
||||
event_msecs = -1; /* None of the events specified a timeout */
|
||||
else
|
||||
event_msecs = MAX(0, TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod));
|
||||
else {
|
||||
event_msecs = TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod);
|
||||
event_msecs = MAX(0, event_msecs);
|
||||
}
|
||||
|
||||
#if HAVE_PCAP
|
||||
#ifndef PCAP_CAN_DO_SELECT
|
||||
|
|
|
|||
|
|
@ -261,8 +261,11 @@ int select_loop(struct npool *nsp, int msec_timeout) {
|
|||
nse = next_expirable_event(nsp);
|
||||
if (!nse)
|
||||
event_msecs = -1; /* None of the events specified a timeout */
|
||||
else
|
||||
event_msecs = MAX(0, TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod));
|
||||
else {
|
||||
event_msecs = TIMEVAL_MSEC_SUBTRACT(nse->timeout, nsock_tod);
|
||||
event_msecs = MAX(0, event_msecs);
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_PCAP
|
||||
#ifndef PCAP_CAN_DO_SELECT
|
||||
|
|
|
|||
|
|
@ -927,7 +927,8 @@ enum nsock_loopstatus nsock_loop(nsock_pool nsp, int msec_timeout) {
|
|||
}
|
||||
|
||||
if (msec_timeout >= 0) {
|
||||
msecs_left = MAX(0, TIMEVAL_MSEC_SUBTRACT(loop_timeout, nsock_tod));
|
||||
msecs_left = TIMEVAL_MSEC_SUBTRACT(loop_timeout, nsock_tod);
|
||||
msecs_left = MAX(0, msecs_left);
|
||||
if (msecs_left == 0 && loopnum > 0) {
|
||||
quitstatus = NSOCK_LOOP_TIMEOUT;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue