diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-15 12:50:37 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-15 12:50:37 +0000 |
commit | b861a707522e8625b4a5b4145b97a8825037572f (patch) | |
tree | 99c8e48bc690579af3177a6fb4f375f464dfa0bc /src/alarm.c | |
parent | 41f3e135db165fff931a07ef79e7731037d22941 (diff) | |
download | conntrack-tools-b861a707522e8625b4a5b4145b97a8825037572f.tar.gz conntrack-tools-b861a707522e8625b4a5b4145b97a8825037572f.zip |
Max Kellermann <max@duempel.org>
Use list_for_each_entry() instead of list_for_each()
Diffstat (limited to 'src/alarm.c')
-rw-r--r-- | src/alarm.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/alarm.c b/src/alarm.c index a64c37a..8d3ae48 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -48,12 +48,9 @@ void init_alarm(struct alarm_list *t) void __add_alarm(struct alarm_list *alarm) { - struct list_head *i; struct alarm_list *t; - list_for_each(i, &alarm_list) { - t = (struct alarm_list *) i; - + list_for_each_entry(t, &alarm_list, head) { if (timercmp(&alarm->tv, &t->tv, <)) { list_add_tail(&alarm->head, &t->head); return; @@ -89,11 +86,9 @@ void mod_alarm(struct alarm_list *alarm, unsigned long sc, unsigned long usc) int get_next_alarm(struct timeval *tv, struct timeval *next_alarm) { - struct list_head *i; struct alarm_list *t; - list_for_each(i, &alarm_list) { - t = (struct alarm_list *) i; + list_for_each_entry(t, &alarm_list, head) { timersub(&t->tv, tv, next_alarm); return 1; } @@ -102,15 +97,12 @@ int get_next_alarm(struct timeval *tv, struct timeval *next_alarm) int do_alarm_run(struct timeval *next_alarm) { - struct list_head *i, *tmp; - struct alarm_list *t; + struct alarm_list *t, *tmp; struct timeval tv; gettimeofday(&tv, NULL); - list_for_each_safe(i, tmp, &alarm_list) { - t = (struct alarm_list *) i; - + list_for_each_entry_safe(t, tmp, &alarm_list, head) { if (timercmp(&t->tv, &tv, >)) { timersub(&t->tv, &tv, next_alarm); return 1; |