[glib] Parse G_DEBUG only once



commit 943a18b5643443438820eae3453d3b279213547e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 12 18:36:52 2011 -0500

    Parse G_DEBUG only once

 glib/glib-init.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 09a9ef7..eb6d8e8 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -196,6 +196,7 @@ static void
 g_debug_init (void)
 {
   const GDebugKey keys[] = {
+    { "gc-friendly", 1 },
     {"fatal-warnings",  G_LOG_LEVEL_WARNING | 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));
 
-  g_log_always_fatal |= flags;
-}
-
-static void
-g_mem_init (void)
-{
-  const GDebugKey keys[] = {
-    { "gc-friendly", 1 },
-  };
+  g_log_always_fatal |= flags & G_LOG_LEVEL_MASK;
 
-  if (g_parse_debug_envvar ("G_DEBUG", keys, G_N_ELEMENTS (keys)))
-    g_mem_gc_friendly = TRUE;
+  g_mem_gc_friendly = flags & 1;
 }
 
 static void
@@ -222,7 +214,6 @@ glib_init (void)
 {
   g_messages_prefixed_init ();
   g_debug_init ();
-  g_mem_init ();
 }
 
 #if defined (G_OS_WIN32)



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