Refactor: move private watcher members to a union

This will save a few bytes of stack/heap for users.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-10-30 10:58:29 +01:00
1 parent 1f6fa93314
commit e5bc49a8e6
4 files changed
+21 -14

No files matched your search

+3 -3
View File
@@ -123,8 +123,8 @@ int uev_timer_set(uev_t *w, int timeout, int period)
return -1;
}
w->timeout = timeout;
w->period = period;
w->u.t.timeout = timeout;
w->u.t.period = period;
if (w->ctx->running) {
struct itimerspec time;
@@ -153,7 +153,7 @@ int uev_timer_start(uev_t *w)
if (-1 != w->fd)
uev_watcher_stop(w);
return uev_timer_set(w, w->timeout, w->period);
return uev_timer_set(w, w->u.t.timeout, w->u.t.period);
}
/**