You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

92 lines
3.8 KiB

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