Transformed function macros in util.h to inline functions

This commit is contained in:
Bert Münnich
2011-09-29 10:16:13 +02:00
parent d369f10aa5
commit 22d4e991d5
7 changed files with 35 additions and 24 deletions

6
main.c
View File

@ -144,7 +144,7 @@ void set_timeout(timeout_f handler, int time, bool overwrite) {
if (timeouts[i].handler == handler) {
if (!timeouts[i].active || overwrite) {
gettimeofday(&timeouts[i].when, 0);
MSEC_ADD_TO_TIMEVAL(time, &timeouts[i].when);
tv_add_msec(&timeouts[i].when, time);
timeouts[i].active = true;
}
return;
@ -170,7 +170,7 @@ bool check_timeouts(struct timeval *t) {
gettimeofday(&now, 0);
while (i < ARRLEN(timeouts)) {
if (timeouts[i].active) {
tdiff = TIMEDIFF(&timeouts[i].when, &now);
tdiff = tv_diff(&timeouts[i].when, &now);
if (tdiff <= 0) {
timeouts[i].active = false;
if (timeouts[i].handler)
@ -183,7 +183,7 @@ bool check_timeouts(struct timeval *t) {
i++;
}
if (tmin > 0 && t)
MSEC_TO_TIMEVAL(tmin, t);
tv_set_msec(t, tmin);
return tmin > 0;
}