gplugin/gplugin
Clone
Summary
Browse
Changes
Graph
Simplify some error freeing
12 months ago, Elliott Sales de Andrade
574a15115c40
Parents
2695cbb5e004
Children
7371e0ba5b32
Simplify some error freeing
Also, clarify the state of an `error` in a test.
Testing Done:
Compiled and ran tests.
Reviewed at https://reviews.imfreedom.org/r/2380/
3 files changed, 4 insertions(+), 4 deletions(-)
+1
-2
gplugin/gplugin-file-source.c
+1
-2
gplugin/gplugin-file-tree.c
+2
-0
gplugin/tests/test-option-group.c
--- a/gplugin/gplugin-file-source.c Thu Mar 02 23:54:07 2023 -0600
+++ b/gplugin/gplugin-file-source.c Wed Mar 22 21:18:48 2023 -0500
@@ -214,8 +214,7 @@
gint errors = 0;
/* Clear any error messages from our last scan. */
- g_list_free_full(file_source->error_messages, (GDestroyNotify)g_free);
- file_source->error_messages = NULL;
+ g_clear_list(&file_source->error_messages, (GDestroyNotify)g_free);
for(GNode *dir = file_source->root->children; dir; dir = dir->next) {
GPluginFileTreeEntry *e = dir->data;
--- a/gplugin/gplugin-file-tree.c Thu Mar 02 23:54:07 2023 -0600
+++ b/gplugin/gplugin-file-tree.c Wed Mar 22 21:18:48 2023 -0500
@@ -106,8 +106,7 @@
path,
(error->message) ? error->message : _("unknown failure"));
- g_error_free(error);
- error = NULL;
+ g_clear_error(&error);
continue;
}
--- a/gplugin/tests/test-option-group.c Thu Mar 02 23:54:07 2023 -0600
+++ b/gplugin/tests/test-option-group.c Wed Mar 22 21:18:48 2023 -0500
@@ -42,6 +42,8 @@
g_strfreev(argv);
+ g_assert_no_error(error);
+
/* the above gplugin_get_option_group will call gplugin_init if it hasn't
* been called yet. Until gplugin_init is called manager will be NULL.
*/