[libsoup] Re-fix _SOUP_ATOMIC_INTERN_STRING to not cause strict-aliasing warnings



commit 05b6c532d2f0eade1774a6c6fd6693b51cf90b8d
Author: Dan Winship <danw gnome org>
Date:   Fri Jul 31 16:39:40 2009 -0400

    Re-fix _SOUP_ATOMIC_INTERN_STRING to not cause strict-aliasing warnings
    
    http://bugzilla.gnome.org/show_bug.cgi?id=588771

 libsoup/soup-method.c |   30 +++++++++++++++---------------
 libsoup/soup-method.h |   30 +++++++++++++++---------------
 libsoup/soup-misc.h   |    2 +-
 libsoup/soup-uri.c    |    2 +-
 libsoup/soup-uri.h    |    2 +-
 5 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/libsoup/soup-method.c b/libsoup/soup-method.c
index cae311f..de7d589 100644
--- a/libsoup/soup-method.c
+++ b/libsoup/soup-method.c
@@ -14,21 +14,21 @@
 /* Explicit assignment to NULL is to help the OS X linker not be
  * stupid. #522957
  */
-const char *_SOUP_METHOD_CONNECT = NULL;
-const char *_SOUP_METHOD_COPY = NULL;
-const char *_SOUP_METHOD_DELETE = NULL;
-const char *_SOUP_METHOD_GET = NULL;
-const char *_SOUP_METHOD_HEAD = NULL;
-const char *_SOUP_METHOD_LOCK = NULL;
-const char *_SOUP_METHOD_MKCOL = NULL;
-const char *_SOUP_METHOD_MOVE = NULL;
-const char *_SOUP_METHOD_OPTIONS = NULL;
-const char *_SOUP_METHOD_POST = NULL;
-const char *_SOUP_METHOD_PROPFIND = NULL;
-const char *_SOUP_METHOD_PROPPATCH = NULL;
-const char *_SOUP_METHOD_PUT = NULL;
-const char *_SOUP_METHOD_TRACE = NULL;
-const char *_SOUP_METHOD_UNLOCK = NULL;
+gpointer _SOUP_METHOD_CONNECT = NULL;
+gpointer _SOUP_METHOD_COPY = NULL;
+gpointer _SOUP_METHOD_DELETE = NULL;
+gpointer _SOUP_METHOD_GET = NULL;
+gpointer _SOUP_METHOD_HEAD = NULL;
+gpointer _SOUP_METHOD_LOCK = NULL;
+gpointer _SOUP_METHOD_MKCOL = NULL;
+gpointer _SOUP_METHOD_MOVE = NULL;
+gpointer _SOUP_METHOD_OPTIONS = NULL;
+gpointer _SOUP_METHOD_POST = NULL;
+gpointer _SOUP_METHOD_PROPFIND = NULL;
+gpointer _SOUP_METHOD_PROPPATCH = NULL;
+gpointer _SOUP_METHOD_PUT = NULL;
+gpointer _SOUP_METHOD_TRACE = NULL;
+gpointer _SOUP_METHOD_UNLOCK = NULL;
 
 /**
  * SOUP_METHOD_OPTIONS:
diff --git a/libsoup/soup-method.h b/libsoup/soup-method.h
index e716b8e..2934cca 100644
--- a/libsoup/soup-method.h
+++ b/libsoup/soup-method.h
@@ -58,22 +58,22 @@ G_BEGIN_DECLS
 /* Do not use these variables directly; use the macros above, which
  * ensure that they get initialized properly.
  */
-extern const char *_SOUP_METHOD_OPTIONS;
-extern const char *_SOUP_METHOD_GET;
-extern const char *_SOUP_METHOD_HEAD;
-extern const char *_SOUP_METHOD_POST;
-extern const char *_SOUP_METHOD_PUT;
-extern const char *_SOUP_METHOD_DELETE;
-extern const char *_SOUP_METHOD_TRACE;
-extern const char *_SOUP_METHOD_CONNECT;
+extern gpointer _SOUP_METHOD_OPTIONS;
+extern gpointer _SOUP_METHOD_GET;
+extern gpointer _SOUP_METHOD_HEAD;
+extern gpointer _SOUP_METHOD_POST;
+extern gpointer _SOUP_METHOD_PUT;
+extern gpointer _SOUP_METHOD_DELETE;
+extern gpointer _SOUP_METHOD_TRACE;
+extern gpointer _SOUP_METHOD_CONNECT;
 
-extern const char *_SOUP_METHOD_PROPFIND;
-extern const char *_SOUP_METHOD_PROPPATCH;
-extern const char *_SOUP_METHOD_MKCOL;
-extern const char *_SOUP_METHOD_COPY;
-extern const char *_SOUP_METHOD_MOVE;
-extern const char *_SOUP_METHOD_LOCK;
-extern const char *_SOUP_METHOD_UNLOCK;
+extern gpointer _SOUP_METHOD_PROPFIND;
+extern gpointer _SOUP_METHOD_PROPPATCH;
+extern gpointer _SOUP_METHOD_MKCOL;
+extern gpointer _SOUP_METHOD_COPY;
+extern gpointer _SOUP_METHOD_MOVE;
+extern gpointer _SOUP_METHOD_LOCK;
+extern gpointer _SOUP_METHOD_UNLOCK;
 
 G_END_DECLS
 
diff --git a/libsoup/soup-misc.h b/libsoup/soup-misc.h
index f8dde10..c36712c 100644
--- a/libsoup/soup-misc.h
+++ b/libsoup/soup-misc.h
@@ -33,7 +33,7 @@ guint              soup_str_case_hash        (gconstpointer key);
 gboolean           soup_str_case_equal       (gconstpointer v1,
 					      gconstpointer v2);
 
-#define _SOUP_ATOMIC_INTERN_STRING(variable, value) (g_once_init_enter ((gsize *)&variable) ? (g_once_init_leave ((gsize *)&variable, GPOINTER_TO_SIZE (g_intern_static_string (value))), variable) : variable)
+#define _SOUP_ATOMIC_INTERN_STRING(variable, value) (g_atomic_pointer_get (&(variable)) ? (variable) : (g_atomic_pointer_set (&(variable), (gpointer)g_intern_static_string (value)), (variable)))
 
 /* SSL stuff */
 
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 876b175..5552f63 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -95,7 +95,7 @@ static void append_uri_encoded (GString *str, const char *in, const char *extra_
 static char *uri_decoded_copy (const char *str, int length);
 static char *uri_normalized_copy (const char *str, int length, const char *unescape_extra, gboolean fixup);
 
-const char *_SOUP_URI_SCHEME_HTTP, *_SOUP_URI_SCHEME_HTTPS;
+gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
 
 static inline const char *
 soup_uri_get_scheme (const char *scheme, int len)
diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h
index c05f3f2..b540e40 100644
--- a/libsoup/soup-uri.h
+++ b/libsoup/soup-uri.h
@@ -33,7 +33,7 @@ GType     soup_uri_get_type          (void);
 
 #define SOUP_URI_SCHEME_HTTP  _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTP, "http")
 #define SOUP_URI_SCHEME_HTTPS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTPS, "https")
-extern const char *_SOUP_URI_SCHEME_HTTP, *_SOUP_URI_SCHEME_HTTPS;
+extern gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
 
 SoupURI  *soup_uri_new_with_base         (SoupURI    *base,
 					  const char *uri_string);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]