Use UV_VERSION_HEX to decide whether we need libuv shim functions
Instead of having a configure check for every missing function that has been added in later version of libuv, we now use UV_VERSION_HEX to decide whether we need the shim or not.
This commit is contained in:
@@ -378,24 +378,6 @@ typedef __int64 off_t;
|
||||
/* Define to 1 if you have the `SSL_CTX_up_ref' function. */
|
||||
#define SSL_CTX_UP_REF 1
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_get_data' function. */
|
||||
#define HAVE_UV_HANDLE_GET_DATA 1
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_set_data' function. */
|
||||
#define HAVE_UV_HANDLE_SET_DATA 1
|
||||
|
||||
/* Define to 1 if you have the `uv_os_getenv' function. */
|
||||
#define HAVE_UV_OS_GETENV 1
|
||||
|
||||
/* Define to 1 if you have the `uv_os_setenv' function. */
|
||||
#define HAVE_UV_OS_SETENV 1
|
||||
|
||||
/* Define to 1 if you have the `uv_req_get_data' function. */
|
||||
#define HAVE_UV_REQ_GET_DATA 1
|
||||
|
||||
/* Define to 1 if you have the `uv_req_set_data' function. */
|
||||
#define HAVE_UV_REQ_SET_DATA 1
|
||||
|
||||
/* GSSAPI Related defines */
|
||||
@HAVE_GSSAPI@
|
||||
@HAVE_GSSAPI_H@
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "netmgr-int.h"
|
||||
|
||||
#ifndef HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX < UV_VERSION(1, 27, 0)
|
||||
int
|
||||
isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
int err = 0;
|
||||
@@ -46,7 +46,7 @@ isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* ifndef HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX < UV_VERSION(1, 27, 0) */
|
||||
|
||||
int
|
||||
isc_uv_udp_freebind(uv_udp_t *handle, const struct sockaddr *addr,
|
||||
|
||||
@@ -19,43 +19,49 @@
|
||||
* library version.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_UV_HANDLE_GET_DATA
|
||||
#define UV_VERSION(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
|
||||
|
||||
#if UV_VERSION_HEX < UV_VERSION(1, 19, 0)
|
||||
static inline void *
|
||||
uv_handle_get_data(const uv_handle_t *handle) {
|
||||
return (handle->data);
|
||||
}
|
||||
#endif /* ifndef HAVE_UV_HANDLE_GET_DATA */
|
||||
|
||||
#ifndef HAVE_UV_HANDLE_SET_DATA
|
||||
static inline void
|
||||
uv_handle_set_data(uv_handle_t *handle, void *data) {
|
||||
handle->data = data;
|
||||
}
|
||||
#endif /* ifndef HAVE_UV_HANDLE_SET_DATA */
|
||||
|
||||
#ifndef HAVE_UV_REQ_GET_DATA
|
||||
static inline void *
|
||||
uv_req_get_data(const uv_req_t *req) {
|
||||
return (req->data);
|
||||
}
|
||||
#endif /* ifndef HAVE_UV_REQ_GET_DATA */
|
||||
|
||||
#ifndef HAVE_UV_REQ_SET_DATA
|
||||
static inline void
|
||||
uv_req_set_data(uv_req_t *req, void *data) {
|
||||
req->data = data;
|
||||
}
|
||||
#endif /* ifndef HAVE_UV_REQ_SET_DATA */
|
||||
#endif /* UV_VERSION_HEX < UV_VERSION(1, 19, 0) */
|
||||
|
||||
#ifndef HAVE_UV_SLEEP
|
||||
#if UV_VERSION_HEX < UV_VERSION(1, 34, 0)
|
||||
#define uv_sleep(msec) usleep(msec * 1000)
|
||||
#endif
|
||||
#endif /* UV_VERSION_HEX < UV_VERSION(1, 34, 0) */
|
||||
|
||||
#ifdef HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX < UV_VERSION(1, 27, 0)
|
||||
int
|
||||
isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr);
|
||||
/*%<
|
||||
* Associate the UDP handle to a remote address and port, so every message sent
|
||||
* by this handle is automatically sent to that destination.
|
||||
*
|
||||
* NOTE: This is just a limited shim for uv_udp_connect() as it requires the
|
||||
* handle to be bound.
|
||||
*/
|
||||
#else /* UV_VERSION_HEX < UV_VERSION(1, 27, 0) */
|
||||
#define isc_uv_udp_connect uv_udp_connect
|
||||
#else
|
||||
#endif /* UV_VERSION_HEX < UV_VERSION(1, 27, 0) */
|
||||
|
||||
#ifndef HAVE_UV_OS_GETENV
|
||||
#if UV_VERSION_HEX < UV_VERSION(1, 12, 0)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -79,23 +85,9 @@ uv_os_getenv(const char *name, char *buffer, size_t *size) {
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* HAVE_UV_OS_GETENV */
|
||||
|
||||
#ifndef HAVE_UV_OS_SETENV
|
||||
#define uv_os_setenv(name, value) setenv(name, value, 0)
|
||||
#endif /* HAVE_UV_OS_SETENV */
|
||||
|
||||
int
|
||||
isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr);
|
||||
/*%<
|
||||
* Associate the UDP handle to a remote address and port, so every message sent
|
||||
* by this handle is automatically sent to that destination.
|
||||
*
|
||||
* NOTE: This is just a limited shim for uv_udp_connect() as it requires the
|
||||
* handle to be bound.
|
||||
*/
|
||||
|
||||
#endif
|
||||
#endif /* UV_VERSION_HEX < UV_VERSION(1, 12, 0) */
|
||||
|
||||
int
|
||||
isc_uv_udp_freebind(uv_udp_t *handle, const struct sockaddr *addr,
|
||||
|
||||
Reference in New Issue
Block a user