Blame SOURCES/0009-tree-Cleanup-_create_from_location_async_helper.patch

0a59fa
From be4906d64b091397b897d351fd09c1146bc10f93 Mon Sep 17 00:00:00 2001
0a59fa
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
0a59fa
Date: Tue, 21 May 2019 13:33:27 +0200
0a59fa
Subject: [PATCH] tree: Cleanup _create_from_location_async_helper()
0a59fa
MIME-Version: 1.0
0a59fa
Content-Type: text/plain; charset=UTF-8
0a59fa
Content-Transfer-Encoding: 8bit
0a59fa
0a59fa
There's no need to pass neither the URL nor the cancellable to this
0a59fa
function as those can be taken directly from data.
0a59fa
0a59fa
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
0a59fa
Reviewed-by: Cole Robinson <crobinso@redhat.com>
0a59fa
(cherry picked from commit dfda02598034737610b69fdd08d62f62cbf5b0cb)
0a59fa
---
0a59fa
 osinfo/osinfo_tree.c | 27 ++++++++-------------------
0a59fa
 1 file changed, 8 insertions(+), 19 deletions(-)
0a59fa
0a59fa
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
0a59fa
index 2e6a4ee..df03303 100644
0a59fa
--- a/osinfo/osinfo_tree.c
0a59fa
+++ b/osinfo/osinfo_tree.c
0a59fa
@@ -596,10 +596,8 @@ static OsinfoTree *load_keyinfo(const gchar *location,
0a59fa
 }
0a59fa
 
0a59fa
 static void
0a59fa
-osinfo_tree_create_from_location_async_helper(const gchar *url,
0a59fa
-                                              const gchar *treeinfo,
0a59fa
-                                              GCancellable *cancellable,
0a59fa
-                                              CreateFromLocationAsyncData *data);
0a59fa
+osinfo_tree_create_from_location_async_helper(CreateFromLocationAsyncData *data,
0a59fa
+                                              const gchar *treeinfo);
0a59fa
 
0a59fa
 static void on_location_read(GObject *source,
0a59fa
                              GAsyncResult *res,
0a59fa
@@ -622,10 +620,7 @@ static void on_location_read(GObject *source,
0a59fa
         /* It means no ".treeinfo" file has been found. Try again, this time
0a59fa
          * looking for a "treeinfo" file. */
0a59fa
         if (g_str_equal(data->treeinfo, ".treeinfo")) {
0a59fa
-            osinfo_tree_create_from_location_async_helper(data->location,
0a59fa
-                                                          "treeinfo",
0a59fa
-                                                          g_task_get_cancellable(data->res),
0a59fa
-                                                          data);
0a59fa
+            osinfo_tree_create_from_location_async_helper(data, "treeinfo");
0a59fa
             return;
0a59fa
         }
0a59fa
 
0a59fa
@@ -652,17 +647,14 @@ static void on_location_read(GObject *source,
0a59fa
 }
0a59fa
 
0a59fa
 static void
0a59fa
-osinfo_tree_create_from_location_async_helper(const gchar *url,
0a59fa
-                                              const gchar *treeinfo,
0a59fa
-                                              GCancellable *cancellable,
0a59fa
-                                              CreateFromLocationAsyncData *data)
0a59fa
+osinfo_tree_create_from_location_async_helper(CreateFromLocationAsyncData *data,
0a59fa
+                                              const gchar *treeinfo)
0a59fa
 {
0a59fa
     gchar *location;
0a59fa
 
0a59fa
-    g_return_if_fail(url != NULL);
0a59fa
     g_return_if_fail(treeinfo != NULL);
0a59fa
 
0a59fa
-    location = g_strdup_printf("%s/%s", url, treeinfo);
0a59fa
+    location = g_strdup_printf("%s/%s", data->location, treeinfo);
0a59fa
 
0a59fa
     g_clear_object(&data->file);
0a59fa
     data->file = g_file_new_for_uri(location);
0a59fa
@@ -671,7 +663,7 @@ osinfo_tree_create_from_location_async_helper(const gchar *url,
0a59fa
     data->treeinfo = g_strdup(treeinfo);
0a59fa
 
0a59fa
     g_file_load_contents_async(data->file,
0a59fa
-                               cancellable,
0a59fa
+                               g_task_get_cancellable(data->res),
0a59fa
                                on_location_read,
0a59fa
                                data);
0a59fa
     g_free(location);
0a59fa
@@ -704,10 +696,7 @@ void osinfo_tree_create_from_location_async(const gchar *location,
0a59fa
 
0a59fa
     data->location = g_strdup(location);
0a59fa
 
0a59fa
-    osinfo_tree_create_from_location_async_helper(location,
0a59fa
-                                                  ".treeinfo",
0a59fa
-                                                  cancellable,
0a59fa
-                                                  data);
0a59fa
+    osinfo_tree_create_from_location_async_helper(data, ".treeinfo");
0a59fa
 }
0a59fa
 
0a59fa
 
0a59fa
-- 
0a59fa
2.21.0
0a59fa