diff options
author | LRN <lrn1986@gmail.com> | 2012-11-01 16:45:45 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2012-11-01 16:45:45 +0000 |
commit | 549784896976cd2feaf7c1096720300df1cecc26 (patch) | |
tree | 3d2a647b97f735d9b17ce5a2877a2ce9971be8fa /src | |
parent | 4df851487dba3f31f2bfd1e5fc1c78d2c26ca66c (diff) | |
download | gnunet-549784896976cd2feaf7c1096720300df1cecc26.tar.gz gnunet-549784896976cd2feaf7c1096720300df1cecc26.zip |
W32: Remove unnecessary 0 and -1 checks
Diffstat (limited to 'src')
-rw-r--r-- | src/util/network.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/util/network.c b/src/util/network.c index 125eaca8b..69db7cd25 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1450,10 +1450,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1450 | 1450 | ||
1451 | /* Copy all the writes to the except, so we can detect connect() errors */ | 1451 | /* Copy all the writes to the except, so we can detect connect() errors */ |
1452 | for (i = 0; i < awrite.fd_count; i++) | 1452 | for (i = 0; i < awrite.fd_count; i++) |
1453 | { | 1453 | FD_SET (awrite.fd_array[i], &aexcept); |
1454 | if (awrite.fd_array[i] != 0 && awrite.fd_array[i] != -1) | ||
1455 | FD_SET (awrite.fd_array[i], &aexcept); | ||
1456 | } | ||
1457 | if (aread.fd_count > 0 || awrite.fd_count > 0 || aexcept.fd_count > 0) | 1454 | if (aread.fd_count > 0 || awrite.fd_count > 0 || aexcept.fd_count > 0) |
1458 | selectret = select (1, (rfds != NULL) ? &aread : NULL, | 1455 | selectret = select (1, (rfds != NULL) ? &aread : NULL, |
1459 | (wfds != NULL) ? &awrite : NULL, &aexcept, &select_timeout); | 1456 | (wfds != NULL) ? &awrite : NULL, &aexcept, &select_timeout); |
@@ -1472,10 +1469,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1472 | have checked that descriptors were in awrite originally before re-adding them from | 1469 | have checked that descriptors were in awrite originally before re-adding them from |
1473 | aexcept. Luckily, GNUnet never uses aexcept for anything, so this does not become a problem (yet). */ | 1470 | aexcept. Luckily, GNUnet never uses aexcept for anything, so this does not become a problem (yet). */ |
1474 | for (i = 0; i < aexcept.fd_count; i++) | 1471 | for (i = 0; i < aexcept.fd_count; i++) |
1475 | { | 1472 | FD_SET (aexcept.fd_array[i], &awrite); |
1476 | if (aexcept.fd_array[i] != 0 && aexcept.fd_array[i] != -1) | ||
1477 | FD_SET (aexcept.fd_array[i], &awrite); | ||
1478 | } | ||
1479 | 1473 | ||
1480 | /* If our select returned something or is a 0-timed request, then also check the pipes and get out of here! */ | 1474 | /* If our select returned something or is a 0-timed request, then also check the pipes and get out of here! */ |
1481 | /* Sadly, it means code duplication :( */ | 1475 | /* Sadly, it means code duplication :( */ |
@@ -1751,10 +1745,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1751 | * but we don't use OOB data. | 1745 | * but we don't use OOB data. |
1752 | */ | 1746 | */ |
1753 | for (i = 0; i < awrite.fd_count; i++) | 1747 | for (i = 0; i < awrite.fd_count; i++) |
1754 | { | 1748 | FD_SET (awrite.fd_array[i], &aexcept); |
1755 | if (awrite.fd_array[i] != 0 && awrite.fd_array[i] != -1) | ||
1756 | FD_SET (awrite.fd_array[i], &aexcept); | ||
1757 | } | ||
1758 | ResetEvent (select_finished_event); | 1749 | ResetEvent (select_finished_event); |
1759 | SetEvent (select_standby_event); | 1750 | SetEvent (select_standby_event); |
1760 | } | 1751 | } |
@@ -1798,10 +1789,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1798 | } | 1789 | } |
1799 | /* Check aexcept, add its contents to awrite */ | 1790 | /* Check aexcept, add its contents to awrite */ |
1800 | for (i = 0; i < aexcept.fd_count; i++) | 1791 | for (i = 0; i < aexcept.fd_count; i++) |
1801 | { | 1792 | FD_SET (aexcept.fd_array[i], &awrite); |
1802 | if (aexcept.fd_array[i] != 0 && aexcept.fd_array[i] != -1) | ||
1803 | FD_SET (aexcept.fd_array[i], &awrite); | ||
1804 | } | ||
1805 | } | 1793 | } |
1806 | 1794 | ||
1807 | returnedpos = returncode - WAIT_OBJECT_0; | 1795 | returnedpos = returncode - WAIT_OBJECT_0; |