const-ify a few more functions in event.h

This commit is contained in:
Nick Mathewson 2010-02-02 15:44:10 -05:00
parent f4190bfb85
commit d38a7a1931
2 changed files with 12 additions and 11 deletions

13
event.c
View File

@ -392,7 +392,8 @@ event_base_new(void)
} }
static int 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; struct event_config_entry *entry;
@ -418,7 +419,7 @@ event_is_method_disabled(const char *name)
} }
int int
event_base_get_features(struct event_base *base) event_base_get_features(const struct event_base *base)
{ {
return base->evsel->features; return base->evsel->features;
} }
@ -477,7 +478,7 @@ event_disable_debug_mode(void)
#endif #endif
struct event_base * struct event_base *
event_base_new_with_config(struct event_config *cfg) event_base_new_with_config(const struct event_config *cfg)
{ {
int i; int i;
struct event_base *base; struct event_base *base;
@ -1222,7 +1223,7 @@ event_base_dispatch(struct event_base *event_base)
} }
const char * const char *
event_base_get_method(struct event_base *base) event_base_get_method(const struct event_base *base)
{ {
EVUTIL_ASSERT(base); EVUTIL_ASSERT(base);
return (base->evsel->name); return (base->evsel->name);
@ -1600,7 +1601,7 @@ event_priority_set(struct event *ev, int pri)
*/ */
int 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; struct timeval now, res;
int flags = 0; int flags = 0;
@ -1631,7 +1632,7 @@ event_pending(struct event *ev, short event, struct timeval *tv)
} }
int int
_event_initialized(struct event *ev, int need_fd) _event_initialized(const struct event *ev, int need_fd)
{ {
if (!(ev->ev_flags & EVLIST_INIT)) if (!(ev->ev_flags & EVLIST_INIT))
return 0; return 0;

View File

@ -126,7 +126,7 @@ int event_base_dispatch(struct event_base *);
@param eb the event_base structure returned by event_base_new() @param eb the event_base structure returned by event_base_new()
@return a string identifying the kernel event mechanism (kqueue, epoll, etc.) @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. 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. 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. 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. 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() @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. 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. 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) #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. Get the signal number assigned to an event.