From: Guus Sliepen Date: Fri, 4 Oct 2019 19:08:34 +0000 (+0200) Subject: Avoid casting function pointers. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=9457a9cdb66473ad36923845b0f5fb359eec2ef0;p=meshlink Avoid casting function pointers. --- diff --git a/src/meshlink.c b/src/meshlink.c index a9988855..5940c70e 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1773,8 +1773,9 @@ bool meshlink_send(meshlink_handle_t *mesh, meshlink_node_t *destination, const return true; } -void meshlink_send_from_queue(event_loop_t *loop, meshlink_handle_t *mesh) { +void meshlink_send_from_queue(event_loop_t *loop, void *data) { (void)loop; + meshlink_handle_t *mesh = data; vpn_packet_t *packet = meshlink_queue_pop(&mesh->outpacketqueue); if(!packet) { diff --git a/src/meshlink_internal.h b/src/meshlink_internal.h index b31ffad4..a8561806 100644 --- a/src/meshlink_internal.h +++ b/src/meshlink_internal.h @@ -247,7 +247,7 @@ typedef struct meshlink_packethdr { uint8_t source[16]; } __attribute__((__packed__)) meshlink_packethdr_t; -extern void meshlink_send_from_queue(event_loop_t *el, meshlink_handle_t *mesh); +extern void meshlink_send_from_queue(event_loop_t *loop, void *mesh); extern void update_node_status(meshlink_handle_t *mesh, struct node_t *n); extern void update_node_pmtu(meshlink_handle_t *mesh, struct node_t *n); extern meshlink_log_level_t global_log_level; diff --git a/src/net.c b/src/net.c index c7c6723c..c3937307 100644 --- a/src/net.c +++ b/src/net.c @@ -704,7 +704,7 @@ int main_loop(meshlink_handle_t *mesh) { //Add signal handler mesh->datafromapp.signum = 0; - signal_add(&(mesh->loop), &(mesh->datafromapp), (signal_cb_t)meshlink_send_from_queue, mesh, mesh->datafromapp.signum); + signal_add(&mesh->loop, &mesh->datafromapp, meshlink_send_from_queue, mesh, mesh->datafromapp.signum); if(!event_loop_run(&mesh->loop, &mesh->mesh_mutex)) { logger(mesh, MESHLINK_ERROR, "Error while waiting for input: %s", strerror(errno));