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.
This commit is contained in:
parent
5222f213f4
commit
eb6afe7669
1 changed files with 20 additions and 20 deletions
|
@ -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__
|
||||
|
|
Loading…
Reference in a new issue