projects
/
pazpar2-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9b6c0dd
)
Simplify IOCHAN destrouction
author
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 22 Feb 2010 14:57:04 +0000
(15:57 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 22 Feb 2010 14:57:04 +0000
(15:57 +0100)
src/eventl.c
patch
|
blob
|
history
diff --git
a/src/eventl.c
b/src/eventl.c
index
a263c64
..
a2abda5
100644
(file)
--- a/
src/eventl.c
+++ b/
src/eventl.c
@@
-145,7
+145,7
@@
static int event_loop(iochan_man_t man, IOCHAN *iochans)
{
do /* loop as long as there are active associations to process */
{
{
do /* loop as long as there are active associations to process */
{
- IOCHAN p, nextp;
+ IOCHAN p, *nextp;
fd_set in, out, except;
int res, max;
static struct timeval nullto = {0, 0}, to;
fd_set in, out, except;
int res, max;
static struct timeval nullto = {0, 0}, to;
@@
-260,30
+260,17
@@
static int event_loop(iochan_man_t man, IOCHAN *iochans)
}
run_fun(man, p);
}
}
run_fun(man, p);
}
- for (p = *iochans; p; p = nextp)
- {
- nextp = p->next;
-
+ for (nextp = iochans; *nextp; )
+ {
+ IOCHAN p = *nextp;
if (p->destroyed && p->thread_users == 0)
{
if (p->destroyed && p->thread_users == 0)
{
- IOCHAN tmp = p, pr;
-
- /* Now reset the pointers */
- if (p == *iochans)
- *iochans = p->next;
- else
- {
- for (pr = *iochans; pr; pr = pr->next)
- if (pr->next == p)
- break;
- assert(pr); /* grave error if it weren't there */
- pr->next = p->next;
- }
- if (nextp == p)
- nextp = p->next;
- xfree(tmp);
+ *nextp = p->next;
+ xfree(p);
+ break;
}
}
- }
+ nextp = &p->next;
+ }
}
while (*iochans);
return 0;
}
while (*iochans);
return 0;