From 72dfb211cd584507af5e0f82ffce0db4f36b68c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Fri, 2 Aug 2024 16:46:17 +0200 Subject: [PATCH] Use correct signature for event_callback_fn (libevent) in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the correct libevent2 type `evutil_socket_t` instead of `int` when implementing the libevent2 callback function in our tests. On Windows evutil_socket_t is an intptr_t (long long int). Defined in include/event2/event.h: typedef void(* event_callback_fn )(evutil_socket_t, short, void *) Signed-off-by: Björn Svensson --- tests/client_test.c | 2 +- tests/clusterclient_async.c | 4 ++-- tests/clusterclient_reconnect_async.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/client_test.c b/tests/client_test.c index 564638b4..822dd1e2 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -1583,7 +1583,7 @@ void async_disconnect(valkeyAsyncContext *ac) { } /* Testcase timeout, will trigger a failure */ -void timeout_cb(int fd, short event, void *arg) { +void timeout_cb(evutil_socket_t fd, short event, void *arg) { (void) fd; (void) event; (void) arg; printf("Timeout in async testing!\n"); exit(1); diff --git a/tests/clusterclient_async.c b/tests/clusterclient_async.c index 134de2c2..8e19a688 100644 --- a/tests/clusterclient_async.c +++ b/tests/clusterclient_async.c @@ -54,7 +54,7 @@ int num_running = 0; int resend_failed_cmd = 0; int send_to_all = 0; -void sendNextCommand(int, short, void *); +void sendNextCommand(evutil_socket_t, short, void *); void printReply(const valkeyReply *reply) { switch (reply->type) { @@ -102,7 +102,7 @@ void replyCallback(valkeyClusterAsyncContext *acc, void *r, void *privdata) { } } -void sendNextCommand(int fd, short kind, void *arg) { +void sendNextCommand(evutil_socket_t fd, short kind, void *arg) { UNUSED(fd); UNUSED(kind); valkeyClusterAsyncContext *acc = arg; diff --git a/tests/clusterclient_reconnect_async.c b/tests/clusterclient_reconnect_async.c index e0ed7618..3b76e9d6 100644 --- a/tests/clusterclient_reconnect_async.c +++ b/tests/clusterclient_reconnect_async.c @@ -20,7 +20,7 @@ /* Unfortunately there is no error code for this error to match */ #define VALKEY_ENOCLUSTER "ERR This instance has cluster support disabled" -void sendNextCommand(int, short, void *); +void sendNextCommand(evutil_socket_t, short, void *); void connectToValkey(valkeyClusterAsyncContext *acc) { /* reset context in case of reconnect */ @@ -61,7 +61,7 @@ void replyCallback(valkeyClusterAsyncContext *acc, void *r, void *privdata) { event_base_once(acc->adapter, -1, EV_TIMEOUT, sendNextCommand, acc, NULL); } -void sendNextCommand(int fd, short kind, void *arg) { +void sendNextCommand(evutil_socket_t fd, short kind, void *arg) { UNUSED(fd); UNUSED(kind); valkeyClusterAsyncContext *acc = arg;