diff --git a/src/cron.c b/src/cron.c index 796ff7a..344b326 100644 --- a/src/cron.c +++ b/src/cron.c @@ -72,11 +72,11 @@ int uev_cron_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, time_t when if (fd < 0) return -1; - if (uev_watcher_init(ctx, w, UEV_CRON_TYPE, cb, arg, fd, UEV_READ)) + if (_uev_watcher_init(ctx, w, UEV_CRON_TYPE, cb, arg, fd, UEV_READ)) goto exit; if (uev_cron_set(w, when, interval)) { - uev_watcher_stop(w); + _uev_watcher_stop(w); exit: close(fd); return -1; @@ -132,7 +132,7 @@ int uev_cron_set(uev_t *w, time_t when, time_t interval) return 1; } - return uev_watcher_start(w); + return _uev_watcher_start(w); } /** diff --git a/src/io.c b/src/io.c index 9295c9f..5c64d49 100644 --- a/src/io.c +++ b/src/io.c @@ -44,10 +44,10 @@ int uev_io_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int fd, int e return -1; } - if (uev_watcher_init(ctx, w, UEV_IO_TYPE, cb, arg, fd, events)) + if (_uev_watcher_init(ctx, w, UEV_IO_TYPE, cb, arg, fd, events)) return -1; - return uev_watcher_start(w); + return _uev_watcher_start(w); } /** @@ -62,7 +62,7 @@ int uev_io_set(uev_t *w, int fd, int events) { if ((events & UEV_ONESHOT) && w->active) - return uev_watcher_rearm(w); + return _uev_watcher_rearm(w); /* Ignore any errors, only to clean up anything lingering ... */ uev_io_stop(w); @@ -89,7 +89,7 @@ int uev_io_start(uev_t *w) */ int uev_io_stop(uev_t *w) { - return uev_watcher_stop(w); + return _uev_watcher_stop(w); } /** diff --git a/src/private.h b/src/private.h index 7670213..6eb960d 100644 --- a/src/private.h +++ b/src/private.h @@ -81,13 +81,13 @@ struct uev; uev_type_t /* Internal API for dealing with generic watchers */ -int uev_watcher_init (uev_ctx_t *ctx, struct uev *w, uev_type_t type, - void (*cb)(struct uev *, void *, int), void *arg, - int fd, int events); -int uev_watcher_start (struct uev *w); -int uev_watcher_stop (struct uev *w); -int uev_watcher_active(struct uev *w); -int uev_watcher_rearm (struct uev *w); +int _uev_watcher_init (uev_ctx_t *ctx, struct uev *w, uev_type_t type, + void (*cb)(struct uev *, void *, int), void *arg, + int fd, int events); +int _uev_watcher_start (struct uev *w); +int _uev_watcher_stop (struct uev *w); +int _uev_watcher_active(struct uev *w); +int _uev_watcher_rearm (struct uev *w); #endif /* LIBUEV_PRIVATE_H_ */ diff --git a/src/signal.c b/src/signal.c index 9f94bf2..3e30a24 100644 --- a/src/signal.c +++ b/src/signal.c @@ -56,11 +56,11 @@ int uev_signal_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int signo if (fd < 0) return -1; - if (uev_watcher_init(ctx, w, UEV_SIGNAL_TYPE, cb, arg, fd, UEV_READ)) + if (_uev_watcher_init(ctx, w, UEV_SIGNAL_TYPE, cb, arg, fd, UEV_READ)) goto exit; if (uev_signal_set(w, signo)) { - uev_watcher_stop(w); + _uev_watcher_stop(w); exit: close(fd); return -1; @@ -109,7 +109,7 @@ int uev_signal_set(uev_t *w, int signo) if (signalfd(w->fd, &mask, SFD_NONBLOCK) < 0) return -1; - return uev_watcher_start(w); + return _uev_watcher_start(w); } @@ -140,7 +140,7 @@ int uev_signal_start(uev_t *w) */ int uev_signal_stop(uev_t *w) { - if (uev_watcher_stop(w)) + if (_uev_watcher_stop(w)) return -1; close(w->fd); diff --git a/src/timer.c b/src/timer.c index 22c825d..cd9813b 100644 --- a/src/timer.c +++ b/src/timer.c @@ -76,11 +76,11 @@ int uev_timer_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int timeou if (fd < 0) return -1; - if (uev_watcher_init(ctx, w, UEV_TIMER_TYPE, cb, arg, fd, UEV_READ)) + if (_uev_watcher_init(ctx, w, UEV_TIMER_TYPE, cb, arg, fd, UEV_READ)) goto exit; if (uev_timer_set(w, timeout, period)) { - uev_watcher_stop(w); + _uev_watcher_stop(w); exit: close(fd); return -1; @@ -135,7 +135,7 @@ int uev_timer_set(uev_t *w, int timeout, int period) return 1; } - return uev_watcher_start(w); + return _uev_watcher_start(w); } /** @@ -152,7 +152,7 @@ int uev_timer_start(uev_t *w) } if (-1 != w->fd) - uev_watcher_stop(w); + _uev_watcher_stop(w); return uev_timer_set(w, w->u.t.timeout, w->u.t.period); } @@ -168,7 +168,7 @@ int uev_timer_stop(uev_t *w) /* Stop kernel timer */ uev_timer_set(w, 0, 0); - if (uev_watcher_stop(w)) + if (_uev_watcher_stop(w)) return -1; /* Close timerfd, will have to be reopened again on reset */ diff --git a/src/uev.c b/src/uev.c index f8d2540..b38aeb0 100644 --- a/src/uev.c +++ b/src/uev.c @@ -57,7 +57,7 @@ static int is_valid_fd(int fd) } /* Private to libuEv, do not use directly! */ -int uev_watcher_init(uev_ctx_t *ctx, uev_t *w, uev_type_t type, uev_cb_t *cb, void *arg, int fd, int events) +int _uev_watcher_init(uev_ctx_t *ctx, uev_t *w, uev_type_t type, uev_cb_t *cb, void *arg, int fd, int events) { if (!ctx || !w) { errno = EINVAL; @@ -76,7 +76,7 @@ int uev_watcher_init(uev_ctx_t *ctx, uev_t *w, uev_type_t type, uev_cb_t *cb, vo } /* Private to libuEv, do not use directly! */ -int uev_watcher_start(uev_t *w) +int _uev_watcher_start(uev_t *w) { struct epoll_event ev; @@ -102,7 +102,7 @@ int uev_watcher_start(uev_t *w) } /* Private to libuEv, do not use directly! */ -int uev_watcher_stop(uev_t *w) +int _uev_watcher_stop(uev_t *w) { if (!w) { errno = EINVAL; @@ -125,7 +125,7 @@ int uev_watcher_stop(uev_t *w) } /* Private to libuEv, do not use directly! */ -int uev_watcher_active(uev_t *w) +int _uev_watcher_active(uev_t *w) { if (!w) return 0; @@ -134,7 +134,7 @@ int uev_watcher_active(uev_t *w) } /* Private to libuEv, do not use directly! */ -int uev_watcher_rearm(uev_t *w) +int _uev_watcher_rearm(uev_t *w) { struct epoll_event ev; @@ -280,7 +280,7 @@ int uev_run(uev_ctx_t *ctx, int flags) /* If not valid anymore, try to remove, ignore any errors. */ if (!is_valid_fd(w->fd)) - uev_watcher_stop(w); + _uev_watcher_stop(w); /* Must recreate epoll fd now ... */ if (_init(ctx, 1)) { @@ -293,10 +293,10 @@ int uev_run(uev_ctx_t *ctx, int flags) if (w->active) { w->active = 0; LIST_REMOVE(w, link); - uev_watcher_start(w); + _uev_watcher_start(w); } } - uev_watcher_start(retry); + _uev_watcher_start(retry); /* New efd, restart everything! */ ctx->errors = 0; diff --git a/src/uev.h b/src/uev.h index db86844..52e0c7a 100644 --- a/src/uev.h +++ b/src/uev.h @@ -45,10 +45,10 @@ #define UEV_NONBLOCK 2 /* Macros */ -#define uev_io_active(w) uev_watcher_active(w) -#define uev_timer_active(w) uev_watcher_active(w) -#define uev_cron_active(w) uev_watcher_active(w) -#define uev_signal_active(w) uev_watcher_active(w) +#define uev_io_active(w) _uev_watcher_active(w) +#define uev_timer_active(w) _uev_watcher_active(w) +#define uev_cron_active(w) _uev_watcher_active(w) +#define uev_signal_active(w) _uev_watcher_active(w) /* Event watcher */ typedef struct uev {