mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 22:10:12 -04:00
r15341@tombo: nickm | 2008-04-29 14:09:50 -0400
Use internal implementation for evutil_timercmp() everywhere, to avoid bugs when the platform timercmp() has never heard of <= or >=. Also, replace timercmp() usage in min_heap.c with call to evutil_timercmp(). svn:r744
This commit is contained in:
parent
4cff82bb4f
commit
9626a421de
@ -77,6 +77,8 @@ Changes in current version:
|
||||
o provide bufferevent_input and bufferevent_output without requiring knowledge of the structure
|
||||
o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
|
||||
o convert evhttp_connection to use bufferevents.
|
||||
o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
|
||||
|
||||
|
||||
Changes in 1.4.0:
|
||||
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
||||
|
@ -159,14 +159,10 @@ int evutil_make_socket_nonblocking(evutil_socket_t sock);
|
||||
#define evutil_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
|
||||
#endif
|
||||
|
||||
#ifdef _EVENT_HAVE_TIMERCMP
|
||||
#define evutil_timercmp(tvp, uvp, cmp) timercmp((tvp), (uvp), cmp)
|
||||
#else
|
||||
#define evutil_timercmp(tvp, uvp, cmp) \
|
||||
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
|
||||
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
|
||||
((tvp)->tv_sec cmp (uvp)->tv_sec))
|
||||
#endif
|
||||
|
||||
#ifdef _EVENT_HAVE_TIMERISSET
|
||||
#define evutil_timerisset(tvp) timerisset(tvp)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define _MIN_HEAP_H_
|
||||
|
||||
#include "event2/event.h"
|
||||
#include "event2/util.h"
|
||||
|
||||
typedef struct min_heap
|
||||
{
|
||||
@ -51,7 +52,7 @@ static inline void min_heap_shift_down_(min_heap_t* s, unsigned hole_i
|
||||
|
||||
int min_heap_elem_greater(struct event *a, struct event *b)
|
||||
{
|
||||
return timercmp(&a->ev_timeout, &b->ev_timeout, >);
|
||||
return evutil_timercmp(&a->ev_timeout, &b->ev_timeout, >);
|
||||
}
|
||||
|
||||
void min_heap_ctor(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user