summaryrefslogtreecommitdiff
path: root/glib/gmem.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-09-17 17:56:33 -0400
committerRyan Lortie <desrt@desrt.ca>2011-09-21 15:55:36 -0400
commit2c7388c19a3f7895ee49a5bc7219822a50b5b514 (patch)
treeaca0dbb57bdc8fd767f9a050661f8fec3470beb3 /glib/gmem.c
parentf35362f3ae4a4bcc6c0d03b129758b2989e8cd79 (diff)
downloadglib-2c7388c19a3f7895ee49a5bc7219822a50b5b514.tar.gz
libglib: stop using g_mutex_new
Use G_MUTEX_INIT or g_mutex_init() as appropriate.
Diffstat (limited to 'glib/gmem.c')
-rw-r--r--glib/gmem.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/glib/gmem.c b/glib/gmem.c
index 1553ed7c2..ee87a1ec7 100644
--- a/glib/gmem.c
+++ b/glib/gmem.c
@@ -600,7 +600,7 @@ static guint *profile_data = NULL;
static gsize profile_allocs = 0;
static gsize profile_zinit = 0;
static gsize profile_frees = 0;
-static GMutex *gmem_profile_mutex = NULL;
+static GMutex gmem_profile_mutex = G_MUTEX_INIT;
#ifdef G_ENABLE_DEBUG
static volatile gsize g_trap_free_size = 0;
static volatile gsize g_trap_realloc_size = 0;
@@ -614,14 +614,14 @@ profiler_log (ProfilerJob job,
gsize n_bytes,
gboolean success)
{
- g_mutex_lock (gmem_profile_mutex);
+ g_mutex_lock (&gmem_profile_mutex);
if (!profile_data)
{
profile_data = standard_calloc ((MEM_PROFILE_TABLE_SIZE + 1) * 8,
sizeof (profile_data[0]));
if (!profile_data) /* memory system kiddin' me, eh? */
{
- g_mutex_unlock (gmem_profile_mutex);
+ g_mutex_unlock (&gmem_profile_mutex);
return;
}
}
@@ -645,7 +645,7 @@ profiler_log (ProfilerJob job,
else
profile_frees += n_bytes;
}
- g_mutex_unlock (gmem_profile_mutex);
+ g_mutex_unlock (&gmem_profile_mutex);
}
static void
@@ -711,7 +711,7 @@ g_mem_profile (void)
if (G_UNLIKELY (!g_mem_initialized))
g_mem_init_nomessage();
- g_mutex_lock (gmem_profile_mutex);
+ g_mutex_lock (&gmem_profile_mutex);
local_allocs = profile_allocs;
local_zinit = profile_zinit;
@@ -719,14 +719,14 @@ g_mem_profile (void)
if (!profile_data)
{
- g_mutex_unlock (gmem_profile_mutex);
+ g_mutex_unlock (&gmem_profile_mutex);
return;
}
memcpy (local_data, profile_data,
(MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0]));
- g_mutex_unlock (gmem_profile_mutex);
+ g_mutex_unlock (&gmem_profile_mutex);
g_print ("GLib Memory statistics (successful operations):\n");
profile_print_locked (local_data, TRUE);
@@ -950,7 +950,4 @@ _g_mem_thread_init_noprivate_nomessage (void)
* unlocking a mutex does not yet work.
*/
g_mem_init_nomessage();
-#ifndef G_DISABLE_CHECKS
- gmem_profile_mutex = g_mutex_new ();
-#endif
}