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

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