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