Skip to content
Browse files

Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
	event.c
	win32select.c
  • Loading branch information...
2 parents 2b6fe8b + 160e58b commit 6c14d564304d8a557f2e1f06b5e31dc0645ce0ab Nick Mathewson committed
Showing with 14 additions and 3 deletions.
  1. +3 −0 event.c
  2. +5 −1 include/event2/buffer.h
  3. +5 −1 include/event2/util.h
  4. +1 −1 win32select.c
View
3 event.c
@@ -2005,6 +2005,7 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
{
int flags = 0;
+ EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
event_debug_assert_is_setup_(ev);
if (ev->ev_flags & EVLIST_INSERTED)
@@ -2024,6 +2025,8 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
evutil_timeradd(&ev->ev_base->tv_clock_diff, &tmp, tv);
}
+ EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
+
return (flags & event);
}
View
6 include/event2/buffer.h
@@ -632,7 +632,11 @@ int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
@param ap a varargs va_list argument array that will be passed to vprintf(3)
@return The number of bytes added if successful, or -1 if an error occurred.
*/
-int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap);
+int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 0)))
+#endif
+;
/**
View
6 include/event2/util.h
@@ -478,7 +478,11 @@ int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
/** Replacement for vsnprintf to get consistent behavior on platforms for
which the return value of snprintf does not conform to C99.
*/
-int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap);
+int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
+#ifdef __GNUC__
+ __attribute__((format(printf, 3, 0)))
+#endif
+;
/** Replacement for inet_ntop for platforms which lack it. */
const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len);
View
2 win32select.c
@@ -304,7 +304,7 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
win32op->readset_out->fd_count : win32op->writeset_out->fd_count;
if (!fd_count) {
- long msec = evutil_tv_to_msec_(tv);
+ long msec = tv ? evutil_tv_to_msec_(tv) : LONG_MAX;
/* Sleep's DWORD argument is unsigned long */
if (msec < 0)
msec = LONG_MAX;

0 comments on commit 6c14d56

Please sign in to comment.
Something went wrong with that request. Please try again.