From 2368c6d056dbc82ca6b15dea0fc7e1112e6827fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Wed, 31 Jul 2024 16:48:07 +0200 Subject: [PATCH] dir: do not pass a GError to g_file_enumerate_children if ignoring it We seem to have no interest in the specific error, as we are using it locally just to "return". So there's no point in having the error in the first place. In consequence, the error is only used in the loop and can be declared locally to it. --- common/flatpak-dir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index bdbbf3d9..a86c9156 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -3922,7 +3922,6 @@ _flatpak_dir_scan_new_flatpakrepos (const char *dir_str, { g_autoptr(GFile) dir = NULL; g_autoptr(GFileEnumerator) dir_enum = NULL; - g_autoptr(GError) my_error = NULL; g_return_if_fail (dir_str != NULL); g_return_if_fail (flatpakrepos != NULL); @@ -3931,8 +3930,8 @@ _flatpak_dir_scan_new_flatpakrepos (const char *dir_str, dir_enum = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, - NULL, &my_error); - if (my_error != NULL) + NULL, NULL); + if (dir_enum == NULL) return; while (TRUE) @@ -3940,12 +3939,13 @@ _flatpak_dir_scan_new_flatpakrepos (const char *dir_str, GFileInfo *file_info; const char *name; guint32 type; + g_autoptr(GError) local_error = NULL; if (!g_file_enumerator_iterate (dir_enum, &file_info, NULL, - NULL, &my_error)) + NULL, &local_error)) { g_info ("Unexpected error reading file in %s: %s", - dir_str, my_error->message); + dir_str, local_error->message); break; }