Skip to content

Commit

Permalink
Deprecate EVENT_FD and EVENT_SIGNAL.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nmathewson committed Feb 3, 2010
1 parent d38a7a1 commit f6b2694
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
5 changes: 3 additions & 2 deletions evmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
8 changes: 0 additions & 8 deletions include/event2/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions include/event2/event_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions include/event2/event_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f6b2694

Please sign in to comment.