From: Nick Mathewson Date: Wed, 3 Feb 2010 06:16:47 +0000 (-0500) Subject: Deprecate EVENT_FD and EVENT_SIGNAL. X-Git-Tag: release-2.0.4-alpha~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6b269498af6538d3c2a0c3bf0dae4630584c66a;p=libevent Deprecate EVENT_FD and EVENT_SIGNAL. These are old aliases for event_get_fd and event_get_signal, and they haven't been the preferred way of doing things since 2.0.1-alpha. For a while, we made them use struct event if it was included, but call event_get_(fd|signal) if it wasn't. This was entirely too cute. --- diff --git a/evmap.c b/evmap.c index 18db0909..24032f4a 100644 --- a/evmap.c +++ b/evmap.c @@ -414,7 +414,8 @@ evmap_signal_add(struct event_base *base, int sig, struct event *ev) base->evsigsel->fdinfo_len); if (TAILQ_EMPTY(&ctx->events)) { - if (evsel->add(base, EVENT_SIGNAL(ev), 0, EV_SIGNAL, NULL) == -1) + if (evsel->add(base, ev->ev_fd, 0, EV_SIGNAL, NULL) + == -1) return (-1); } @@ -436,7 +437,7 @@ evmap_signal_del(struct event_base *base, int sig, struct event *ev) GET_SIGNAL_SLOT(ctx, map, sig, evmap_signal); if (TAILQ_FIRST(&ctx->events) == TAILQ_LAST(&ctx->events, event_list)) { - if (evsel->del(base, EVENT_SIGNAL(ev), 0, EV_SIGNAL, NULL) == -1) + if (evsel->del(base, ev->ev_fd, 0, EV_SIGNAL, NULL) == -1) return (-1); } diff --git a/include/event2/event.h b/include/event2/event.h index aa1f832a..d2153e1b 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -619,14 +619,6 @@ void event_get_assignment(const struct event *event, struct event_base **base_ou */ size_t event_get_struct_event_size(void); -#ifndef EVENT_FD -/* We haven't included event_struct.h, so define these as function calls - * rather than as direct struct access. If we include event_struct.h later, - * these macros will be overridden. */ -#define EVENT_FD(ev) ((int)event_get_fd(ev)) -#define EVENT_SIGNAL(ev) ((int)event_get_fd(ev)) -#endif - /** Get the Libevent version. diff --git a/include/event2/event_compat.h b/include/event2/event_compat.h index dfa7e508..eacb1cab 100644 --- a/include/event2/event_compat.h +++ b/include/event2/event_compat.h @@ -329,6 +329,12 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, */ #define signal_initialized(ev) _event_initialized((ev), 0) +#ifndef EVENT_FD +/* These macros are obsolete; use event_get_fd and event_get_signal instead. */ +#define EVENT_FD(ev) ((int)event_get_fd(ev)) +#define EVENT_SIGNAL(ev) event_get_signal(ev) +#endif + #ifdef __cplusplus } #endif diff --git a/include/event2/event_struct.h b/include/event2/event_struct.h index 051bbb7e..02b06691 100644 --- a/include/event2/event_struct.h +++ b/include/event2/event_struct.h @@ -117,15 +117,6 @@ struct event { void *ev_arg; }; -#ifdef EVENT_FD -/* This was defined in event.h, but since we're including event_struct.h, we - * can use the faster versions. */ -#undef EVENT_FD -#undef EVENT_SIGNAL -#define EVENT_SIGNAL(ev) ((int)(ev)->ev_fd) -#define EVENT_FD(ev) ((int)(ev)->ev_fd) -#endif - /* * Key-Value pairs. Can be used for HTTP headers but also for * query argument parsing.