qulogic/gplugin

Merged in feature/remove-gplugin_manager_free_plugin_list (pull request #61)

Feature/remove gplugin manager free plugin list

Approved-by: Richard Laager
Approved-by: Elliott Sales de Andrade
--- a/gplugin-gtk/gplugin-gtk-store.c Sun Feb 23 04:37:17 2020 +0000
+++ b/gplugin-gtk/gplugin-gtk-store.c Sun Feb 23 05:33:06 2020 +0000
@@ -107,7 +107,7 @@
plugins = gplugin_manager_find_plugins(id);
for(l = plugins; l; l = l->next)
gplugin_gtk_store_add_plugin(store, GPLUGIN_PLUGIN(l->data));
- gplugin_manager_free_plugin_list(plugins);
+ g_slist_free_full(plugins, g_object_unref);
}
static gboolean
--- a/gplugin/gplugin-manager.c Sun Feb 23 04:37:17 2020 +0000
+++ b/gplugin/gplugin-manager.c Sun Feb 23 05:33:06 2020 +0000
@@ -628,7 +628,7 @@
}
}
- gplugin_manager_free_plugin_list(dependencies);
+ g_slist_free_full(dependencies, g_object_unref);
return all_loaded;
}
@@ -686,7 +686,7 @@
/* prepend the first found match to our return value */
ret = g_slist_prepend(ret, g_object_ref(matches->data));
- gplugin_manager_free_plugin_list(matches);
+ g_slist_free_full(matches, g_object_unref);
found = TRUE;
@@ -699,7 +699,7 @@
_("failed to find dependency %s for %s"),
dependencies[i], gplugin_plugin_info_get_id(info));
- gplugin_manager_free_plugin_list(ret);
+ g_slist_free_full(ret, g_object_unref);
g_object_unref(G_OBJECT(info));
@@ -1259,8 +1259,8 @@
*
* Returns: (element-type GPlugin.Plugin) (transfer full): A #GSList of
* referenced #GPluginPlugin's matching @id. Call
- * gplugin_manager_free_plugin_list() on the returned value when
- * you're done with it.
+ * g_slist_free_full() with a `DestroyNotify` of g_object_unref() on
+ * the returned value when you're done with it.
*/
GSList *
gplugin_manager_find_plugins(const gchar *id) {
@@ -1289,8 +1289,8 @@
*
* Returns: (element-type GPlugin.Plugin) (transfer full): A #GSList of
* referenced #GPluginPlugin's matching @id. Call
- * gplugin_manager_free_plugin_list() on the returned value when
- * you're done with it.
+ * g_slist_free_full() with a `DestroyNotify` of g_object_unref() on
+ * the returned value when you're done with it.
*/
GSList *
gplugin_manager_find_plugins_with_version(const gchar *id, const gchar *op,
@@ -1361,37 +1361,12 @@
}
}
- gplugin_manager_free_plugin_list(plugins);
+ g_slist_free_full(plugins, g_object_unref);
return g_slist_reverse(filtered);
}
/**
- * gplugin_manager_free_plugin_list:
- * @plugins_list: (element-type GPlugin.Plugin) (nullable): Returned value from
- * plugin_manager_find_plugins().
- *
- * Frees the returned value of gplugin_manager_find_plugins().
- */
-void
-gplugin_manager_free_plugin_list(GSList *plugins_list) {
- GSList *l = NULL;
-
- for(l = plugins_list; l; l = l->next) {
- GPluginPlugin *plugin = NULL;
-
- if(l->data == NULL)
- continue;
-
- plugin = GPLUGIN_PLUGIN(l->data);
-
- g_object_unref(G_OBJECT(plugin));
- }
-
- g_slist_free(plugins_list);
-}
-
-/**
* gplugin_manager_find_plugin:
* @id: The id of the plugin to find.
*
@@ -1415,7 +1390,7 @@
plugin = GPLUGIN_PLUGIN(g_object_ref(G_OBJECT(plugins_list->data)));
- gplugin_manager_free_plugin_list(plugins_list);
+ g_slist_free_full(plugins_list, g_object_unref);
return plugin;
}
@@ -1429,8 +1404,9 @@
*
* Return value: (element-type GPlugin.Plugin) (transfer full): A #GSList of
* #GPluginPlugin's that @plugin depends on, or %NULL on error
- * with @error set. Call #gplugin_manager_free_plugin_list on
- * the returned value when you're done with it.
+ * with @error set. Call g_slist_free_full() with a
+ * `DestroyNotify` of g_object_unref() on the returned value when
+ * you're done with it.
*/
GSList *
gplugin_manager_get_plugin_dependencies(GPluginPlugin *plugin, GError **error) {
--- a/gplugin/gplugin-manager.h Sun Feb 23 04:37:17 2020 +0000
+++ b/gplugin/gplugin-manager.h Sun Feb 23 05:33:06 2020 +0000
@@ -46,7 +46,6 @@
GSList *gplugin_manager_find_plugins(const gchar *id);
GSList *gplugin_manager_find_plugins_with_version(const gchar *id, const gchar *op, const gchar *version);
-void gplugin_manager_free_plugin_list(GSList *plugins_list);
GPluginPlugin *gplugin_manager_find_plugin(const gchar *id);
--- a/gplugin/gplugin-query.c Sun Feb 23 04:37:17 2020 +0000
+++ b/gplugin/gplugin-query.c Sun Feb 23 05:33:06 2020 +0000
@@ -219,7 +219,7 @@
first = FALSE;
}
- gplugin_manager_free_plugin_list(plugins);
+ g_slist_free_full(plugins, g_object_unref);
return TRUE;
}
--- a/gplugin/tests/test-id-collision.c Sun Feb 23 04:37:17 2020 +0000
+++ b/gplugin/tests/test-id-collision.c Sun Feb 23 05:33:06 2020 +0000
@@ -39,7 +39,7 @@
g_assert_cmpuint(g_slist_length(plugins), ==, 2);
- gplugin_manager_free_plugin_list(plugins);
+ g_slist_free_full(plugins, g_object_unref);
}
/******************************************************************************