From: Martin Mares Date: Fri, 8 Oct 2010 13:01:12 +0000 (+0200) Subject: Main: No more calls to GARY_SIZE on an empty timer array X-Git-Tag: v5.0~129^2~18 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=234e54b5b647f36ff89d3d6439bf4b6f9ce1d575;p=libucw.git Main: No more calls to GARY_SIZE on an empty timer array --- diff --git a/ucw/mainloop.c b/ucw/mainloop.c index 561ddd3d..0af9bf14 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -163,7 +163,10 @@ main_get_time(void) static inline uns count_timers(struct main_context *m) { - return GARY_SIZE(m->timer_table) - 1; + if (m->timer_table) + return GARY_SIZE(m->timer_table) - 1; + else + return 0; } void @@ -562,7 +565,7 @@ static void process_timers(struct main_context *m) { struct main_timer *tm; - while (GARY_SIZE(m->timer_table) > 1 && (tm = m->timer_table[1])->expires <= m->now) + while (count_timers(m) && (tm = m->timer_table[1])->expires <= m->now) { DBG("MAIN: Timer %p expired at now-%lld", tm, (long long)(m->now - tm->expires)); tm->handler(tm);