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.
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__
