[pango] Load config file only once



commit abd17535c26f9675a162dc26412cea0384cdeebd
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 14 18:37:06 2012 -0400

    Load config file only once

 pango/pango-utils.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 4aed1c4..2595e34 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -522,6 +522,7 @@ pango_scan_int (const char **pos, int *out)
 }
 
 static GHashTable *config_hash = NULL;
+static gboolean did_read_system_config = FALSE;
 static gboolean did_read_user_config = FALSE;
 
 static void
@@ -608,13 +609,18 @@ read_config_system (void)
 {
   char *filename;
 
-  ensure_config_hash ();
+  if (!did_read_system_config)
+    {
+      did_read_system_config = TRUE;
+
+      ensure_config_hash ();
 
-  filename = g_build_filename (pango_get_sysconf_subdirectory (),
-			       "pangorc",
-			       NULL);
-  read_config_file (filename, FALSE, config_hash);
-  g_free (filename);
+      filename = g_build_filename (pango_get_sysconf_subdirectory (),
+                                   "pangorc",
+			           NULL);
+      read_config_file (filename, FALSE, config_hash);
+      g_free (filename);
+    }
 }
 
 static void



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