diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-02 20:03:19 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-02 20:03:19 -0700 |
commit | 25b5a4a30f8a767bfd4577aa284bd435f7e5fb97 (patch) | |
tree | aa2a27c1ff03e9a32317a6d0871135d2cb66d1b9 | |
parent | 04f0c10b5a45d0bb1a1f8888e0eb2f6db8fc1b84 (diff) |
Make sure events_*.c are fully compatible to callers so plugins built for
a different flavour will still work.
-rw-r--r-- | lib/events.h | 6 | ||||
-rw-r--r-- | lib/events_glib.c | 5 | ||||
-rw-r--r-- | sock.h | 4 |
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/events.h b/lib/events.h index fa30cf27..66c4c6b4 100644 --- a/lib/events.h +++ b/lib/events.h @@ -80,10 +80,8 @@ G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data); G_MODULE_EXPORT void b_event_remove(gint id); -/* For now, closesocket() is only a function when using libevent. With GLib - it's a preprocessor macro. */ -#ifdef EVENTS_LIBEVENT +/* With libevent, this one also cleans up event handlers if that wasn't already + done (the caller is expected to do so but may miss it sometimes). */ G_MODULE_EXPORT void closesocket(int fd); -#endif #endif /* _EVENTS_H_ */ diff --git a/lib/events_glib.c b/lib/events_glib.c index d6ac82cc..3fafc872 100644 --- a/lib/events_glib.c +++ b/lib/events_glib.c @@ -146,3 +146,8 @@ void b_event_remove(gint tag) if (tag > 0) g_source_remove(tag); } + +void closesocket( int fd ) +{ + close( fd ); +} @@ -10,11 +10,7 @@ #define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK) #define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0) #define sockerr_again() (errno == EINPROGRESS || errno == EINTR) -#ifndef EVENTS_LIBEVENT -#define closesocket(a) close(a) -#else void closesocket( int fd ); -#endif #else # include <winsock2.h> # include <ws2tcpip.h> |