mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Rewrite C99-style for loops
This commit is contained in:
@@ -158,8 +158,9 @@ char *mkstr(const char *start, const char *end) {
|
||||
|
||||
/* Like strchr, but don't go past end. Nulls not handled specially. */
|
||||
const char *strchr_p(const char *str, const char *end, char c) {
|
||||
const char *q=str;
|
||||
assert(str && end >= str);
|
||||
for (const char *q = str; q < end; q++) {
|
||||
for (; q < end; q++) {
|
||||
if (*q == c)
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ int new_listen_socket(int type, int proto, const union sockaddr_u *addr, fd_set
|
||||
|
||||
int ncat_listen()
|
||||
{
|
||||
int rc, i, fds_ready;
|
||||
int rc, i, j, fds_ready;
|
||||
fd_set listen_fds;
|
||||
struct timeval tv;
|
||||
struct timeval *tvp = NULL;
|
||||
@@ -405,7 +405,7 @@ restart_fd_loop:
|
||||
goto restart_fd_loop;
|
||||
|
||||
/* Check if any send errors were logged. */
|
||||
for (int j = 0; j < broadcast_fdlist.nfds; j++) {
|
||||
for (j = 0; j < broadcast_fdlist.nfds; j++) {
|
||||
fdi = &broadcast_fdlist.fds[j];
|
||||
if (fdi->lasterr != 0) {
|
||||
close_fd(fdi, 0);
|
||||
@@ -458,7 +458,8 @@ static void handle_connection(int socket_accept, int type, fd_set *listen_fds)
|
||||
&& s.remoteaddr.storage.ss_family != AF_UNIX
|
||||
#endif
|
||||
) {
|
||||
for (int i = 0; i < num_listenaddrs; i++) {
|
||||
int i;
|
||||
for (i = 0; i < num_listenaddrs; i++) {
|
||||
if (listen_socket[i] == socket_accept) {
|
||||
struct fdinfo *lfdi = get_fdinfo(&client_fdlist, socket_accept);
|
||||
union sockaddr_u localaddr = lfdi->remoteaddr;
|
||||
|
||||
Reference in New Issue
Block a user