From: Nick Mathewson Date: Tue, 2 Feb 2010 20:44:10 +0000 (-0500) Subject: const-ify a few more functions in event.h X-Git-Tag: release-2.0.4-alpha~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d38a7a19316002da9e9184402f9252e11766712b;p=libevent const-ify a few more functions in event.h --- diff --git a/event.c b/event.c index 19674c7b..43e49e98 100644 --- a/event.c +++ b/event.c @@ -392,7 +392,8 @@ event_base_new(void) } static int -event_config_is_avoided_method(struct event_config *cfg, const char *method) +event_config_is_avoided_method(const struct event_config *cfg, + const char *method) { struct event_config_entry *entry; @@ -418,7 +419,7 @@ event_is_method_disabled(const char *name) } int -event_base_get_features(struct event_base *base) +event_base_get_features(const struct event_base *base) { return base->evsel->features; } @@ -477,7 +478,7 @@ event_disable_debug_mode(void) #endif struct event_base * -event_base_new_with_config(struct event_config *cfg) +event_base_new_with_config(const struct event_config *cfg) { int i; struct event_base *base; @@ -1222,7 +1223,7 @@ event_base_dispatch(struct event_base *event_base) } const char * -event_base_get_method(struct event_base *base) +event_base_get_method(const struct event_base *base) { EVUTIL_ASSERT(base); return (base->evsel->name); @@ -1600,7 +1601,7 @@ event_priority_set(struct event *ev, int pri) */ int -event_pending(struct event *ev, short event, struct timeval *tv) +event_pending(const struct event *ev, short event, struct timeval *tv) { struct timeval now, res; int flags = 0; @@ -1631,7 +1632,7 @@ event_pending(struct event *ev, short event, struct timeval *tv) } int -_event_initialized(struct event *ev, int need_fd) +_event_initialized(const struct event *ev, int need_fd) { if (!(ev->ev_flags & EVLIST_INIT)) return 0; diff --git a/include/event2/event.h b/include/event2/event.h index a643264b..aa1f832a 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -126,7 +126,7 @@ int event_base_dispatch(struct event_base *); @param eb the event_base structure returned by event_base_new() @return a string identifying the kernel event mechanism (kqueue, epoll, etc.) */ -const char *event_base_get_method(struct event_base *); +const char *event_base_get_method(const struct event_base *); /** Gets all event notification mechanisms supported by Libevent. @@ -205,7 +205,7 @@ enum event_base_config_flag { /** Return a bitmask of the features implemented by an event base. */ -int event_base_get_features(struct event_base *base); +int event_base_get_features(const struct event_base *base); /** Enters a required event method feature that the application demands. @@ -246,7 +246,7 @@ int event_config_set_flag(struct event_config *cfg, int flag); or NULL if no event base can be created with the requested event_config. @see event_base_new(), event_base_free(), event_init(), event_assign() */ -struct event_base *event_base_new_with_config(struct event_config *cfg); +struct event_base *event_base_new_with_config(const struct event_config *); /** Deallocate all memory associated with an event_base, and free the base. @@ -556,7 +556,7 @@ void event_active(struct event *, int, short); is to say, it has been added), or 0 if the event is not added. */ -int event_pending(struct event *, short, struct timeval *); +int event_pending(const struct event *, short, struct timeval *); /** @@ -575,7 +575,7 @@ int event_pending(struct event *, short, struct timeval *); */ #define event_initialized(ev) _event_initialized((ev), 1) -int _event_initialized(struct event *, int check_fd); +int _event_initialized(const struct event *, int check_fd); /** Get the signal number assigned to an event.