[glib/wip/gcleanup] giomodule: Cleanup global data
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup] giomodule: Cleanup global data
- Date: Thu, 7 Nov 2013 22:04:32 +0000 (UTC)
commit 69c65a953fa0039b7af566c9d156bdb8dbbe49df
Author: Stef Walter <stefw gnome org>
Date: Thu Nov 7 23:00:08 2013 +0100
giomodule: Cleanup global data
gio/giomodule.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 92aa97b..962c2a6 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -697,7 +697,8 @@ _g_io_module_get_default_type (const gchar *extension_point,
}
else
{
- default_modules = g_hash_table_new (g_str_hash, g_str_equal);
+ default_modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ G_CLEANUP (default_modules, g_hash_table_unref);
}
_g_io_modules_ensure_loaded ();
@@ -821,7 +822,9 @@ _g_io_module_get_default (const gchar *extension_point,
}
else
{
- default_modules = g_hash_table_new (g_str_hash, g_str_equal);
+ default_modules = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_object_unref);
+ G_CLEANUP (default_modules, g_hash_table_unref);
}
_g_io_modules_ensure_loaded ();
@@ -1098,7 +1101,19 @@ _g_io_modules_ensure_loaded (void)
static void
g_io_extension_point_free (GIOExtensionPoint *ep)
{
+ GList *walk;
+
g_free (ep->name);
+
+ for (walk = ep->extensions; walk != NULL; walk = walk->next)
+ {
+ GIOExtension *extension = walk->data;
+
+ g_free (extension->name);
+ g_slice_free (GIOExtension, extension);
+ }
+ g_list_free (ep->extensions);
+
g_free (ep);
}
@@ -1118,10 +1133,11 @@ g_io_extension_point_register (const char *name)
G_LOCK (extension_points);
if (extension_points == NULL)
- extension_points = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- NULL,
- (GDestroyNotify)g_io_extension_point_free);
+ {
+ extension_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
+ (GDestroyNotify)g_io_extension_point_free);
+ G_CLEANUP (extension_points, g_hash_table_unref);
+ }
ep = g_hash_table_lookup (extension_points, name);
if (ep != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]