Skip to content

Commit

Permalink
uv_getnameinfo const wrapper harmful on ctypes 0.23.0
Browse files Browse the repository at this point in the history
Fixes #159.
  • Loading branch information
aantron committed Sep 5, 2024
1 parent ae9ee9b commit 821bc0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
14 changes: 3 additions & 11 deletions src/c/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ static void luv_getaddrinfo_trampoline(
}

static void luv_getnameinfo_trampoline(
uv_getnameinfo_t *c_request, int status, char *hostname, char *service)
uv_getnameinfo_t *c_request, int status, const char *hostname,
const char *service)
{
caml_acquire_runtime_system();
value callback;
Expand Down Expand Up @@ -413,7 +414,7 @@ uv_getaddrinfo_cb luv_get_getaddrinfo_trampoline(void)
return luv_getaddrinfo_trampoline;
}

luv_getnameinfo_cb luv_get_getnameinfo_trampoline(void)
uv_getnameinfo_cb luv_get_getnameinfo_trampoline(void)
{
return luv_getnameinfo_trampoline;
}
Expand Down Expand Up @@ -619,15 +620,6 @@ int luv_fs_poll_start(
return uv_fs_poll_start(handle, (uv_fs_poll_cb)poll_cb, path, interval);
}

int luv_getnameinfo(
uv_loop_t *loop, uv_getnameinfo_t *req, luv_getnameinfo_cb getnameinfo_cb,
const struct sockaddr *addr, int flags)
{
return
uv_getnameinfo(
loop, req, (uv_getnameinfo_cb)getnameinfo_cb, addr, flags);
}

int luv_read_start(
uv_stream_t *stream, uv_alloc_cb alloc_cb, luv_read_cb read_cb)
{
Expand Down
9 changes: 1 addition & 8 deletions src/c/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ typedef void (*luv_fs_event_cb)(
typedef void (*luv_fs_poll_cb)(
uv_fs_poll_t *handle, int status, uv_stat_t *prev, uv_stat_t *curr);

typedef void (*luv_getnameinfo_cb)(
uv_getnameinfo_t *req, int status, char *hostname, char *service);

typedef void (*luv_read_cb)(uv_stream_t *stream, ssize_t nread, uv_buf_t *buf);

typedef void (*luv_udp_recv_cb)(
Expand All @@ -78,7 +75,7 @@ uv_fs_cb luv_null_fs_callback_pointer(void);
luv_fs_event_cb luv_get_fs_event_trampoline(void);
luv_fs_poll_cb luv_get_fs_poll_trampoline(void);
uv_getaddrinfo_cb luv_get_getaddrinfo_trampoline(void);
luv_getnameinfo_cb luv_get_getnameinfo_trampoline(void);
uv_getnameinfo_cb luv_get_getnameinfo_trampoline(void);
uv_idle_cb luv_get_idle_trampoline(void);
luv_once_cb luv_get_once_trampoline(void);
uv_poll_cb luv_get_poll_trampoline(void);
Expand Down Expand Up @@ -173,10 +170,6 @@ int luv_fs_poll_start(
uv_fs_poll_t *handle, luv_fs_poll_cb poll_cb, const char *path,
unsigned int interval);

int luv_getnameinfo(
uv_loop_t *loop, uv_getnameinfo_t *req, luv_getnameinfo_cb getnameinfo_cb,
const struct sockaddr *addr, int flags);

int luv_read_start(
uv_stream_t *stream, uv_alloc_cb alloc_cb, luv_read_cb read_cb);

Expand Down
2 changes: 1 addition & 1 deletion src/c/luv_c_function_descriptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ struct
(void @-> returning trampoline)

let getnameinfo =
foreign "luv_getnameinfo"
foreign "uv_getnameinfo"
(ptr Loop.t @->
ptr t @->
trampoline @->
Expand Down

0 comments on commit 821bc0b

Please sign in to comment.