On Sun, Apr 21, 2019 at 08:53:11PM +0200, Alexander Bluhm wrote: > I wonder whether SIZE_T_MAX would be better than -1. But they seem > to be equivalent.
I prefer SIZE_T_MAX as well. > > Index: min_heap.h > > =================================================================== > > RCS file: /cvs/src/lib/libevent/min_heap.h,v > > retrieving revision 1.5 > > diff -u -p -r1.5 min_heap.h > > --- min_heap.h 20 Apr 2019 23:22:28 -0000 1.5 > > +++ min_heap.h 20 Apr 2019 23:28:09 -0000 > > @@ -33,7 +33,7 @@ > > > > typedef struct min_heap { > > struct event **p; > > - unsigned n, a; > > + size_t n, a; > > } min_heap_t; Changing n means that at least timeout_correct in event.c must be adjusted as well, because it is used as an unsigned: static void timeout_correct(struct event_base *base, struct timeval *tv) { unsigned int size; ... size = base->timeheap.n; for (; size-- > 0; ++pev) { struct timeval *ev_tv = &(**pev).ev_timeout; timersub(ev_tv, &off, ev_tv); } ... } Looking only at min_heap.h it is okay, but takes a bit polishing to be applicable for all files in libevent. I haven't inspected all occurrences, so no updated patch yet. Tobias