From 4064daddf806b60d5461156de5159aae548d79ee Mon Sep 17 00:00:00 2001 From: Jackson Ming Hu Date: Mon, 1 Jul 2019 14:51:21 +0100 Subject: [PATCH] esp32: compiler complains about insert_wsi as macro --- lib/plat/esp32/esp32-fds.c | 12 ++++++++++++ lib/plat/esp32/private.h | 11 +++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/plat/esp32/esp32-fds.c b/lib/plat/esp32/esp32-fds.c index 7551f1f8d..a6fc86c71 100644 --- a/lib/plat/esp32/esp32-fds.c +++ b/lib/plat/esp32/esp32-fds.c @@ -44,3 +44,15 @@ lws_plat_change_pollfd(struct lws_context *context, { return 0; } + +int +insert_wsi(const struct lws_context *context, struct lws *wsi) +{ + assert(context->lws_lookup[wsi->desc.sockfd - + lws_plat_socket_offset()] == 0); + + context->lws_lookup[wsi->desc.sockfd - \ + lws_plat_socket_offset()] = wsi; + + return 0; +} \ No newline at end of file diff --git a/lib/plat/esp32/private.h b/lib/plat/esp32/private.h index 7b256e856..fa48c5107 100644 --- a/lib/plat/esp32/private.h +++ b/lib/plat/esp32/private.h @@ -90,9 +90,12 @@ gai_strerror(int); #define compatible_close(x) close(x) #define lws_plat_socket_offset() LWIP_SOCKET_OFFSET #define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] -#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd - \ - lws_plat_socket_offset()] == 0); \ - A->lws_lookup[B->desc.sockfd - \ - lws_plat_socket_offset()] = B + +struct lws_context; +struct lws; + +int +insert_wsi(const struct lws_context *context, struct lws *wsi); + #define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0