[gnome-software: 1/2] packagekit: reduce complexity of for loop
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/2] packagekit: reduce complexity of for loop
- Date: Thu, 22 Sep 2022 16:06:12 +0000 (UTC)
commit 06fbeb61767d4a4c4c7935debd8c96cc6b98a3ef
Author: Pablo Correa Gómez <ablocorrea hotmail com>
Date: Wed Sep 21 19:03:39 2022 +0200
packagekit: reduce complexity of for loop
This does not change the behavior, but cleans old excesively-complex
code.
plugins/packagekit/gs-plugin-packagekit.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c
index 35cc786e8..5b601c9cc 100644
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@ -2410,7 +2410,6 @@ gs_plugin_packagekit_refine_history_async (GsPluginPackagekit *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- guint i = 0, j;
GsApp *app;
g_autofree const gchar **package_names = NULL;
g_autoptr(GTask) task = NULL;
@@ -2421,9 +2420,9 @@ gs_plugin_packagekit_refine_history_async (GsPluginPackagekit *self,
/* get an array of package names */
package_names = g_new0 (const gchar *, gs_app_list_length (list) + 1);
- for (j = 0; j < gs_app_list_length (list); j++) {
- app = gs_app_list_index (list, j);
- package_names[i++] = gs_app_get_source_default (app);
+ for (guint i = 0; i < gs_app_list_length (list); i++) {
+ app = gs_app_list_index (list, i);
+ package_names[i] = gs_app_get_source_default (app);
}
g_debug ("getting history for %u packages", gs_app_list_length (list));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]