[glib] G_DEFINE_QUARK: fix up some implementation issues
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] G_DEFINE_QUARK: fix up some implementation issues
- Date: Sat, 8 Sep 2012 18:08:12 +0000 (UTC)
commit 73a100d2ef0c4bf4b201e04e31c90d35a8082a12
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Sep 4 20:54:33 2012 -0400
G_DEFINE_QUARK: fix up some implementation issues
https://bugzilla.gnome.org/show_bug.cgi?id=683360
glib/gquark.h | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/glib/gquark.h b/glib/gquark.h
index 7689447..39d22ab 100644
--- a/glib/gquark.h
+++ b/glib/gquark.h
@@ -48,13 +48,12 @@ const gchar * g_quark_to_string (GQuark quark) G_GNUC_CON
GQuark \
q_n##_quark (void) \
{ \
- static volatile gsize g_define_quark__volatile = 0; \
- if (g_once_init_enter (&g_define_quark__volatile)) \
- { \
- GQuark g_define_quark = g_quark_from_string (#QN); \
- g_once_init_leave (&g_define_quark__volatile, g_define_quark); \
- } \
- return g_define_quark__volatile; \
+ static GQuark q; \
+ \
+ if G_UNLIKELY (q == 0) \
+ q = g_quark_from_static_string (#QN); \
+ \
+ return q; \
}
const gchar * g_intern_string (const gchar *string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]