aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag_pool.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-08 21:01:25 +0200
committerMax Kellermann <max@duempel.org>2012-08-08 21:01:25 +0200
commitc1f90a99f4b33b3b2c05d051f19bd7ed3472c5ff (patch)
treea1eb2e93ff43309ee30fd77ec57db6d10d8fd612 /src/tag_pool.c
parent510097cc37ffe88ddd1bf0587add83654777ded1 (diff)
downloadmpd-c1f90a99f4b33b3b2c05d051f19bd7ed3472c5ff.tar.gz
mpd-c1f90a99f4b33b3b2c05d051f19bd7ed3472c5ff.tar.xz
mpd-c1f90a99f4b33b3b2c05d051f19bd7ed3472c5ff.zip
tag_pool: use GStaticMutex
Eliminates explicit global initialisation.
Diffstat (limited to 'src/tag_pool.c')
-rw-r--r--src/tag_pool.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/tag_pool.c b/src/tag_pool.c
index eabf3e369..2f9b39486 100644
--- a/src/tag_pool.c
+++ b/src/tag_pool.c
@@ -22,7 +22,17 @@
#include <assert.h>
-GMutex *tag_pool_lock = NULL;
+#if GCC_CHECK_VERSION(4, 2)
+/* workaround for a warning caused by G_STATIC_MUTEX_INIT */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+
+GStaticMutex tag_pool_lock = G_STATIC_MUTEX_INIT;
+
+#if GCC_CHECK_VERSION(4, 2)
+#pragma GCC diagnostic pop
+#endif
#define NUM_SLOTS 4096
@@ -81,19 +91,6 @@ static struct slot *slot_alloc(struct slot *next,
return slot;
}
-void tag_pool_init(void)
-{
- g_assert(tag_pool_lock == NULL);
- tag_pool_lock = g_mutex_new();
-}
-
-void tag_pool_deinit(void)
-{
- g_assert(tag_pool_lock != NULL);
- g_mutex_free(tag_pool_lock);
- tag_pool_lock = NULL;
-}
-
struct tag_item *
tag_pool_get_item(enum tag_type type, const char *value, size_t length)
{