ObjFW  Diff

Differences From Artifact [75d8ae44e0]:

To Artifact [e7e7f50976]:


13
14
15
16
17
18
19


20


21
22
23
24


25
26
27
28
29

30
31
32
33

34
35
36

37
38
39












40

41
13
14
15
16
17
18
19
20
21
22
23
24
25
26


27
28
29




30
31
32
33

34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54







+
+

+
+


-
-
+
+

-
-
-
-
+



-
+


-
+



+
+
+
+
+
+
+
+
+
+
+
+
-
+

 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "socket.h"
#ifdef OF_HAVE_THREADS
# include "threading.h"

static of_once_t onceControl = OF_ONCE_INIT;
#endif
static bool initialized = false;

bool
of_init_sockets()
static void
init(void)
{
	if (initialized)
		return true;

#ifdef _WIN32
#if defined(_WIN32)
	WSADATA wsa;

	if (WSAStartup(MAKEWORD(2, 0), &wsa))
		return false;
		return;
#elif defined(__wii__)
	if (net_init() < 0)
		return false;
		return;
#endif

	initialized = true;
}

bool
of_init_sockets()
{
#ifdef OF_HAVE_THREADS
	of_once(&onceControl, init);
#else
	if (!initialized)
		init();
#endif

	return true;
	return initialized;
}