/soc/2013/ankitkv/gobjectification: b820d9a76ce9: Refactored lib...

Ankit Vani a at nevitus.org
Thu Aug 1 07:11:34 EDT 2013


Changeset: b820d9a76ce958b24ddddcfecd521ecb3a047876
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-01 16:22 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b820d9a76ce9

Description:

Refactored libpurple to use the ref'd plugins list

diffstat:

 libpurple/keyring.c |  6 ++++--
 libpurple/plugins.c |  6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diffs (52 lines):

diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -1227,7 +1227,7 @@ void
 purple_keyring_init(void)
 {
 	const gchar *touse;
-	GList *it;
+	GList *plugins, *it;
 
 	purple_keyring_keyrings = NULL;
 	purple_keyring_inuse = NULL;
@@ -1281,7 +1281,8 @@ purple_keyring_init(void)
 
 	purple_keyring_pref_connect();
 
-	for (it = purple_plugins_get_all(); it != NULL; it = it->next)
+	plugins = purple_plugins_find_all();
+	for (it = plugins; it != NULL; it = it->next)
 	{
 		GPluginPlugin *plugin = GPLUGIN_PLUGIN(it->data);
 		GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
@@ -1305,6 +1306,7 @@ purple_keyring_init(void)
 				purple_keyring_loaded_plugins, plugin);
 		}
 	}
+	purple_plugins_free_found_list(plugins);
 
 	if (purple_keyring_inuse == NULL)
 		purple_debug_error("keyring", "Selected keyring failed to load\n");
diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -390,14 +390,16 @@ purple_plugins_get_loaded(void)
 GPluginPlugin *
 purple_plugins_find_by_filename(const char *filename)
 {
-	GList *l;
+	GList *plugins, *l;
+	plugins = purple_plugins_find_all();
 
-	for (l = purple_plugins_get_all(); l != NULL; l = l->next) {
+	for (l = plugins; l != NULL; l = l->next) {
 		GPluginPlugin *plugin = GPLUGIN_PLUGIN(l->data);
 
 		if (purple_strequal(gplugin_plugin_get_filename(plugin), filename))
 			return g_object_ref(plugin);
 	}
+	purple_plugins_free_found_list(plugins);
 
 	return NULL;
 }



More information about the Commits mailing list