From eb6afe76698e3d974bae4615c0cba2e2744183de Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 26 Oct 2021 22:49:45 +0200 Subject: [PATCH] Move net_init() and net_cleanup() upwards These two functions are global, define them at the top of the implementation file. This is consistent with the header file. --- app/src/util/net.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/util/net.c b/app/src/util/net.c index 2b5a0e5e..4b5a4874 100644 --- a/app/src/util/net.c +++ b/app/src/util/net.c @@ -19,6 +19,26 @@ typedef struct in_addr IN_ADDR; #endif +bool +net_init(void) { +#ifdef __WINDOWS__ + WSADATA wsa; + int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0; + if (res < 0) { + LOGC("WSAStartup failed with error %d", res); + return false; + } +#endif + return true; +} + +void +net_cleanup(void) { +#ifdef __WINDOWS__ + WSACleanup(); +#endif +} + static void net_perror(const char *s) { #ifdef _WIN32 @@ -133,26 +153,6 @@ net_shutdown(socket_t socket, int how) { return !shutdown(socket, how); } -bool -net_init(void) { -#ifdef __WINDOWS__ - WSADATA wsa; - int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0; - if (res < 0) { - LOGC("WSAStartup failed with error %d", res); - return false; - } -#endif - return true; -} - -void -net_cleanup(void) { -#ifdef __WINDOWS__ - WSACleanup(); -#endif -} - bool net_close(socket_t socket) { #ifdef __WINDOWS__