summaryrefslogtreecommitdiff
path: root/kqueue.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-10 16:31:02 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-10 16:31:02 +0000
commit7d821580e81072e0eba32d4789fdadca6683329b (patch)
treea9e6614bab2085b1029c00042e22a3d3d5283403 /kqueue.c
parent21a7e7ed67979b9f2444f4671d9bd668ef2ebabf (diff)
downloadlibevent-7d821580e81072e0eba32d4789fdadca6683329b.tar.gz
Fix compile warning on osx: the udata field in struct kevent is supposed to be void*, not intptr_t.
svn:r387
Diffstat (limited to 'kqueue.c')
-rw-r--r--kqueue.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/kqueue.c b/kqueue.c
index c5478062..c6dbf222 100644
--- a/kqueue.c
+++ b/kqueue.c
@@ -48,10 +48,13 @@
#include <inttypes.h>
#endif
-#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
-#define INTPTR(x) (intptr_t)x
+/* Some platforms apparently define the udata field of struct kevent as
+ * intptr_t, whereas others define it as void*. There doesn't seem to be an
+ * easy way to tell them apart via autoconf, so we need to use OS macros. */
+#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__)
+#define PTR_TO_UDATA(x) ((intptr_t)(x))
#else
-#define INTPTR(x) x
+#define PTR_TO_UDATA(x) (x)
#endif
#include "event.h"
@@ -297,7 +300,7 @@ kq_add(void *arg, struct event *ev)
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = INTPTR(ev);
+ kev.udata = PTR_TO_UDATA(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);
@@ -320,7 +323,7 @@ kq_add(void *arg, struct event *ev)
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = INTPTR(ev);
+ kev.udata = PTR_TO_UDATA(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);
@@ -335,7 +338,7 @@ kq_add(void *arg, struct event *ev)
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = INTPTR(ev);
+ kev.udata = PTR_TO_UDATA(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);