constify struct timeval *

svn:r837
This commit is contained in:
Niels Provos 2008-05-17 02:19:21 +00:00
parent 38e97b143f
commit 9ce23febc2
3 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,7 @@
Changes in 1.4.5-stable:
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; pointed out by Forest Wilkinson
Changes in 1.4.4-stable:
o Correct the documentation on buffer printf functions.

10
event.c
View File

@ -406,14 +406,14 @@ event_loopexit_cb(int 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));
@ -550,7 +550,7 @@ event_once_cb(int fd, short events, void *arg)
/* not threadsafe, event scheduled once. */
int
event_once(int fd, short events,
void (*callback)(int, short, void *), void *arg, struct timeval *tv)
void (*callback)(int, short, void *), void *arg, const struct timeval *tv)
{
return event_base_once(current_base, fd, events, callback, arg, tv);
}
@ -558,7 +558,7 @@ event_once(int fd, short events,
/* Schedules an event once */
int
event_base_once(struct event_base *base, int fd, short events,
void (*callback)(int, short, void *), void *arg, struct timeval *tv)
void (*callback)(int, short, void *), void *arg, const struct timeval *tv)
{
struct event_once *eonce;
struct timeval etv;
@ -690,7 +690,7 @@ event_pending(struct event *ev, short event, struct timeval *tv)
}
int
event_add(struct event *ev, struct timeval *tv)
event_add(struct event *ev, const struct timeval *tv)
{
struct event_base *base = ev->ev_base;
const struct eventop *evsel = base->evsel;

15
event.h
View File

@ -400,7 +400,7 @@ int event_base_loop(struct event_base *, 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 *);
/**
@ -417,7 +417,7 @@ int event_loopexit(struct timeval *);
@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_loop() immediately.
@ -559,7 +559,8 @@ void event_set(struct event *, int, short, void (*)(int, short, void *), void *)
@see event_set()
*/
int event_once(int, short, void (*)(int, short, void *), void *, struct timeval *);
int event_once(int, short, void (*)(int, short, void *), void *,
const struct timeval *);
/**
@ -580,7 +581,9 @@ int event_once(int, short, void (*)(int, short, void *), void *, struct timeval
@return 0 if successful, or -1 if an error occurred
@see event_once()
*/
int event_base_once(struct event_base *, int, short, void (*)(int, short, void *), void *, struct timeval *);
int event_base_once(struct event_base *base, int fd, short events,
void (*callback)(int, short, void *), void *arg,
const struct timeval *timeout);
/**
@ -601,7 +604,7 @@ int event_base_once(struct event_base *, int, short, void (*)(int, short, void *
@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 *ev, const struct timeval *timeout);
/**
@ -631,7 +634,7 @@ void event_active(struct event *, int, short);
@return 1 if the event is pending, or 0 if the event has not occurred
*/
int event_pending(struct event *, short, struct timeval *);
int event_pending(struct event *ev, short event, struct timeval *tv);
/**