diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-21 23:29:47 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-21 23:29:47 +0000 |
commit | 2fceb7bd90de7d129435d53c94a55c5a4126c027 (patch) | |
tree | e886704947393c2a2cdc94dae18e17570d8287dc /usr.sbin/rtadvd/timer.c | |
parent | 928ec3c40ba5669e00b228da6d7b973c01279b5a (diff) |
minor KNF. plug a memory leak on reconfig.
Diffstat (limited to 'usr.sbin/rtadvd/timer.c')
-rw-r--r-- | usr.sbin/rtadvd/timer.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c index 88f2417ace2..55f9a221fca 100644 --- a/usr.sbin/rtadvd/timer.c +++ b/usr.sbin/rtadvd/timer.c @@ -1,5 +1,5 @@ -/* $OpenBSD: timer.c,v 1.5 2002/02/16 21:28:08 millert Exp $ */ -/* $KAME: timer.c,v 1.4 2000/05/27 11:30:43 jinmei Exp $ */ +/* $OpenBSD: timer.c,v 1.6 2002/05/21 23:29:46 itojun Exp $ */ +/* $KAME: timer.c,v 1.7 2002/05/21 14:26:55 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -45,7 +45,7 @@ static struct rtadvd_timer timer_head; #define MILLION 1000000 #define TIMEVAL_EQUAL(t1,t2) ((t1)->tv_sec == (t2)->tv_sec &&\ - (t1)->tv_usec == (t2)->tv_usec) + (t1)->tv_usec == (t2)->tv_usec) static struct timeval tm_max = {0x7fffffff, 0x7fffffff}; @@ -75,12 +75,12 @@ rtadvd_add_timer(void (*timeout)(void *), if (timeout == NULL) { syslog(LOG_ERR, - "<%s> timeout function unspecfied", __FUNCTION__); + "<%s> timeout function unspecified", __FUNCTION__); exit(1); } if (update == NULL) { syslog(LOG_ERR, - "<%s> update function unspecfied", __FUNCTION__); + "<%s> update function unspecified", __FUNCTION__); exit(1); } newtimer->expire = timeout; @@ -136,7 +136,7 @@ rtadvd_check_timer() timer_head.tm = tm_max; - while(tm != &timer_head) { + while (tm != &timer_head) { if (TIMEVAL_LEQ(tm->tm, now)) { (*tm->expire)(tm->expire_data); (*tm->update)(tm->update_data, &tm->tm); @@ -152,12 +152,10 @@ rtadvd_check_timer() if (TIMEVAL_EQUAL(&tm_max, &timer_head.tm)) { /* no need to timeout */ return(NULL); - } - else if (TIMEVAL_LT(timer_head.tm, now)) { + } else if (TIMEVAL_LT(timer_head.tm, now)) { /* this may occur when the interval is too small */ returnval.tv_sec = returnval.tv_usec = 0; - } - else + } else TIMEVAL_SUB(&timer_head.tm, &now, &returnval); return(&returnval); } |