[glib] Ensure we're actually initializing the winsock library
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [glib] Ensure we're actually initializing the winsock library
- Date: Wed, 29 Apr 2009 06:26:03 -0400 (EDT)
commit d80e12104f139def9bea28a510bf1d7c103e20f9
Author: Alexander Larsson <alexl redhat com>
Date: Wed Apr 29 12:19:57 2009 +0200
Ensure we're actually initializing the winsock library
It turns out that just calling g_inet_address_get_type() isn't
enough, since its marked G_GNUC_CONST, so the call is optimized
away. If we assign the return value to a volatile location we ensure
it is called.
---
gio/ginetaddress.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index bf6578b..592f76c 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -311,6 +311,7 @@ g_inet_address_new_from_string (const gchar *string)
struct sockaddr_storage sa;
struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;
+ volatile GType type;
gint len;
#else /* !G_OS_WIN32 */
struct in_addr in_addr;
@@ -318,7 +319,7 @@ g_inet_address_new_from_string (const gchar *string)
#endif
/* Make sure _g_networking_init() has been called */
- (void) g_inet_address_get_type ();
+ type = g_inet_address_get_type ();
#ifdef G_OS_WIN32
memset (&sa, 0, sizeof (sa));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]