constify struct timeval *

svn:r836
This commit is contained in:
Niels Provos 2008-05-17 02:14:17 +00:00
parent 134344b79e
commit 8b66f1bd4d
4 changed files with 18 additions and 14 deletions

View File

@ -101,6 +101,7 @@ Changes in current version:
o Make vsnprintf() returns consistent on win32.
o Fix connection keep-alive behavior for HTTP/1.0
o Fix use of freed memory in event_reinit; pointed out by Peter Postma
o constify struct timeval * where possible
Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.

18
event.c
View File

@ -124,7 +124,8 @@ int (*event_sigcb)(void); /* Signal callback when gotsig is set */
volatile sig_atomic_t event_gotsig; /* Set in signal handler */
/* Prototypes */
static inline int event_add_internal(struct event *ev, struct timeval *tv);
static inline int event_add_internal(struct event *ev,
const struct timeval *tv);
static inline int event_del_internal(struct event *ev);
static inline void event_active_internal(struct event *ev, int res,short count);
@ -573,14 +574,14 @@ event_loopexit_cb(evutil_socket_t fd, short what, void *arg)
/* not thread safe */
int
event_loopexit(struct timeval *tv)
event_loopexit(const struct timeval *tv)
{
return (event_once(-1, EV_TIMEOUT, event_loopexit_cb,
current_base, tv));
}
int
event_base_loopexit(struct event_base *event_base, struct timeval *tv)
event_base_loopexit(struct event_base *event_base, const struct timeval *tv)
{
return (event_base_once(event_base, -1, EV_TIMEOUT, event_loopexit_cb,
event_base, tv));
@ -718,7 +719,7 @@ event_once_cb(evutil_socket_t fd, short events, void *arg)
int
event_once(evutil_socket_t fd, short events,
void (*callback)(evutil_socket_t, short, void *),
void *arg, struct timeval *tv)
void *arg, const struct timeval *tv)
{
return event_base_once(current_base, fd, events, callback, arg, tv);
}
@ -727,7 +728,7 @@ event_once(evutil_socket_t fd, short events,
int
event_base_once(struct event_base *base, evutil_socket_t fd, short events,
void (*callback)(evutil_socket_t, short, void *),
void *arg, struct timeval *tv)
void *arg, const struct timeval *tv)
{
struct event_once *eonce;
struct timeval etv;
@ -825,7 +826,8 @@ event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, shor
void
evperiodic_assign(struct event *ev, struct event_base *base,
struct timeval *tv, void (*cb)(evutil_socket_t, short, void *), void *arg)
const struct timeval *tv,
void (*cb)(evutil_socket_t, short, void *), void *arg)
{
event_assign(ev, base, -1, EV_TIMEOUT, cb, arg);
@ -924,7 +926,7 @@ event_get_fd(struct event *ev)
}
int
event_add(struct event *ev, struct timeval *tv)
event_add(struct event *ev, const struct timeval *tv)
{
int res;
@ -938,7 +940,7 @@ event_add(struct event *ev, struct timeval *tv)
}
static inline int
event_add_internal(struct event *ev, struct timeval *tv)
event_add_internal(struct event *ev, const struct timeval *tv)
{
struct event_base *base = ev->ev_base;
const struct eventop *evsel = base->evsel;

View File

@ -224,7 +224,7 @@ int event_base_loop(struct event_base *, int);
@return 0 if successful, or -1 if an error occurred
@see event_loopexit()
*/
int event_base_loopexit(struct event_base *, struct timeval *);
int event_base_loopexit(struct event_base *, const struct timeval *);
/**
Abort the active event_base_loop() immediately.
@ -255,7 +255,7 @@ int event_base_loopbreak(struct event_base *);
*/
void evperiodic_assign(struct event *ev, struct event_base *base,
struct timeval *tv, void (*cb)(int, short, void *), void *arg);
const struct timeval *tv, void (*cb)(int, short, void *), void *arg);
/* Flags to pass to event_set(), event_new(), event_assign(),
* event_pending()... */
@ -396,7 +396,7 @@ void event_free(struct event *);
@return 0 if successful, or -1 if an error occurred
@see event_once()
*/
int event_base_once(struct event_base *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *, struct timeval *);
int event_base_once(struct event_base *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *, const struct timeval *);
/**
Add an event to the set of monitored events.
@ -416,7 +416,7 @@ int event_base_once(struct event_base *, evutil_socket_t, short, void (*)(evutil
@return 0 if successful, or -1 if an error occurred
@see event_del(), event_set()
*/
int event_add(struct event *, struct timeval *);
int event_add(struct event *, const struct timeval *);
/**
Remove an event from the set of monitored events.

View File

@ -103,7 +103,7 @@ int event_loop(int);
@return 0 if successful, or -1 if an error occurred
@see event_loop(), event_base_loop(), event_base_loopexit()
*/
int event_loopexit(struct timeval *);
int event_loopexit(const struct timeval *);
/**
@ -138,7 +138,8 @@ int event_loopbreak(void);
@see event_set()
*/
int event_once(evutil_socket_t , short, void (*)(evutil_socket_t, short, void *), void *, struct timeval *);
int event_once(evutil_socket_t , short,
void (*)(evutil_socket_t, short, void *), void *, const struct timeval *);
/**