chiark
/
gitweb
/
~mdw
/
secnet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
poll: Avoid duplicate array index counting
[secnet]
/
secnet.c
diff --git
a/secnet.c
b/secnet.c
index 7a9d3f009274176620f36f4b8cc5f807c7362278..6d08323ff5152fae567d5bd87972cf0f9097bb71 100644
(file)
--- a/
secnet.c
+++ b/
secnet.c
@@
-291,7
+291,7
@@
uint64_t now_global;
static void run(void)
{
struct poll_interest *i;
static void run(void)
{
struct poll_interest *i;
- int rv, nfds,
remain,
idx;
+ int rv, nfds, idx;
int timeout;
struct pollfd *fds=0;
int allocdfds=0, shortfall=0;
int timeout;
struct pollfd *fds=0;
int allocdfds=0, shortfall=0;
@@
-320,11
+320,11
@@
static void run(void)
allocdfds += shortfall;
fds=safe_realloc_ary(fds,sizeof(*fds),allocdfds, "run");
}
allocdfds += shortfall;
fds=safe_realloc_ary(fds,sizeof(*fds),allocdfds, "run");
}
- remain=allocdfds;
shortfall=0;
idx=0;
timeout=-1;
LIST_FOREACH(i, ®, entry) {
shortfall=0;
idx=0;
timeout=-1;
LIST_FOREACH(i, ®, entry) {
+ int remain=allocdfds-idx;
nfds=remain;
rv=i->before(i->state, fds+idx, &nfds, &timeout);
if (rv!=0) {
nfds=remain;
rv=i->before(i->state, fds+idx, &nfds, &timeout);
if (rv!=0) {
@@
-340,7
+340,6
@@
static void run(void)
i->desc,timeout);
}
idx+=nfds;
i->desc,timeout);
}
idx+=nfds;
- remain-=nfds;
i->nfds=nfds;
}
do {
i->nfds=nfds;
}
do {