Bug 621213 – GDBusProxy and well-known names
[platform/upstream/glib.git] / gio / giomodule.c
index ae83225..e1b1d17 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "giomodule.h"
 #include "giomodule-priv.h"
+#include "gmemorysettingsbackend.h"
 #include "glocalfilemonitor.h"
 #include "glocaldirectorymonitor.h"
 #include "gnativevolumemonitor.h"
  *  it uses the implementations that have been associated with it.
  *  Depending on the use case, it may use all implementations, or
  *  only the one with the highest priority, or pick a specific
- *  one by name. 
+ *  one by name.
+ *
+ *  To avoid opening all modules just to find out what extension
+ *  points they implement, GIO makes use of a caching mechanism,
+ *  see <link linkend="gio-querymodules">gio-querymodules</link>.
+ *  You are expected to run this command after installing a
+ *  GIO module.
  */
 struct _GIOModule {
   GTypeModule parent_instance;
@@ -270,7 +277,7 @@ g_io_modules_scan_all_in_directory (const char *dirname)
   const gchar *name;
   char *filename;
   GDir *dir;
-  struct stat statbuf;
+  GStatBuf statbuf;
   char *data;
   time_t cache_mtime;
   GHashTable *cache;
@@ -321,14 +328,14 @@ g_io_modules_scan_all_in_directory (const char *dirname)
            continue; /* Invalid line, ignore */
 
          *colon = 0; /* terminate filename */
-         file = strdup (line);
+         file = g_strdup (line);
          colon++; /* after colon */
 
          while (g_ascii_isspace (*colon))
            colon++;
 
          extension_points = g_strsplit (colon, ",", -1);
-         g_hash_table_insert (cache, g_strdup (file), extension_points);
+         g_hash_table_insert (cache, file, extension_points);
        }
       g_strfreev (lines);
     }
@@ -382,6 +389,8 @@ g_io_modules_scan_all_in_directory (const char *dirname)
   g_dir_close (dir);
 
   g_hash_table_destroy (cache);
+
+  g_free (filename);
 }
 
 
@@ -563,6 +572,7 @@ _g_io_modules_ensure_loaded (void)
        }
 
       /* Initialize types from built-in "modules" */
+      g_memory_settings_backend_get_type ();
 #if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_LINUX_INOTIFY_H)
       _g_inotify_directory_monitor_get_type ();
       _g_inotify_file_monitor_get_type ();