summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: 0432695)
raw | patch | inline | side by side (from parent 1: 0432695)
author | Florian Forster <ff@octo.it> | |
Fri, 5 May 2017 07:06:17 +0000 (09:06 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Fri, 5 May 2017 08:47:14 +0000 (10:47 +0200) |
Don't have the if-condition and if-body in the same line.
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index 1738255c500cc9a653f2d1d5ceecc94c26d3c054..edc3522f2a93a9c9102adfe4707e3487db047537 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
ptr = ph;
num_fds = 0;
ptr = ph;
num_fds = 0;
- if (fd4 != -1) num_fds++;
- if (fd6 != -1) num_fds++;
- max_fd = fd4 > fd6 ? fd4 : fd6;
+ if (fd4 != -1)
+ num_fds++;
+ if (fd6 != -1)
+ num_fds++;
+ max_fd = (fd4 > fd6) ? fd4 : fd6;
assert (max_fd < FD_SETSIZE);
while (pings > 0 || ptr != NULL)
assert (max_fd < FD_SETSIZE);
while (pings > 0 || ptr != NULL)
FD_ZERO (&write_fds);
FD_ZERO (&err_fds);
FD_ZERO (&write_fds);
FD_ZERO (&err_fds);
- if (fd4 != -1) FD_SET(fd4, &read_fds);
- if (fd6 != -1) FD_SET(fd6, &read_fds);
+ if (fd4 != -1)
+ {
+ FD_SET(fd4, &read_fds);
+ if (ptr != NULL && ptr->addrfamily == AF_INET)
+ FD_SET(fd4, &write_fds);
+ FD_SET(fd4, &err_fds);
+ }
- if (fd4 != -1 && ptr != NULL && ptr->addrfamily == AF_INET)
- FD_SET(fd4, &write_fds);
- if (fd6 != -1 && ptr != NULL && ptr->addrfamily == AF_INET6)
- FD_SET(fd6, &write_fds);
- if (fd4 != -1) FD_SET(fd4, &err_fds);
- if (fd6 != -1) FD_SET(fd6, &err_fds);
+ if (fd6 != -1)
+ {
+ FD_SET(fd6, &read_fds);
+ if (ptr != NULL && ptr->addrfamily == AF_INET6)
+ FD_SET(fd6, &write_fds);
+ FD_SET(fd6, &err_fds);
+ }
if (gettimeofday (&nowtime, NULL) == -1)
{
if (gettimeofday (&nowtime, NULL) == -1)
{