Parse G_DEBUG only once

This commit is contained in:
Matthias Clasen 2011-11-12 18:36:52 -05:00
parent 5d9f05eef1
commit 943a18b564

View File

@ -196,6 +196,7 @@ static void
g_debug_init (void) g_debug_init (void)
{ {
const GDebugKey keys[] = { const GDebugKey keys[] = {
{ "gc-friendly", 1 },
{"fatal-warnings", G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL }, {"fatal-warnings", G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL },
{"fatal-criticals", G_LOG_LEVEL_CRITICAL } {"fatal-criticals", G_LOG_LEVEL_CRITICAL }
}; };
@ -203,18 +204,9 @@ g_debug_init (void)
flags = g_parse_debug_envvar ("G_DEBUG", keys, G_N_ELEMENTS (keys)); flags = g_parse_debug_envvar ("G_DEBUG", keys, G_N_ELEMENTS (keys));
g_log_always_fatal |= flags; g_log_always_fatal |= flags & G_LOG_LEVEL_MASK;
}
static void g_mem_gc_friendly = flags & 1;
g_mem_init (void)
{
const GDebugKey keys[] = {
{ "gc-friendly", 1 },
};
if (g_parse_debug_envvar ("G_DEBUG", keys, G_N_ELEMENTS (keys)))
g_mem_gc_friendly = TRUE;
} }
static void static void
@ -222,7 +214,6 @@ glib_init (void)
{ {
g_messages_prefixed_init (); g_messages_prefixed_init ();
g_debug_init (); g_debug_init ();
g_mem_init ();
} }
#if defined (G_OS_WIN32) #if defined (G_OS_WIN32)