ostree-fetcher: make _ostree_fetcher_stream_uri_sync private

Rename _ostree_fetcher_contents_membuf_sync to
ostree_fetcher_request_uri_to_membuf and drop unused argument
user_data.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2014-11-05 09:48:12 +01:00 committed by Colin Walters
parent c2bc99bc16
commit a5491f98cb
4 changed files with 37 additions and 51 deletions

View File

@ -692,18 +692,9 @@ typedef struct
GInputStream *result_stream; GInputStream *result_stream;
GMainLoop *loop; GMainLoop *loop;
GError **error; GError **error;
gpointer user_data;
} }
FetchUriSyncData; FetchUriSyncData;
static gboolean
run_mainloop_monitor_fetcher (FetchUriSyncData *data)
{
g_main_loop_run (data->loop);
return TRUE;
}
static void static void
fetch_uri_sync_on_complete (GObject *object, fetch_uri_sync_on_complete (GObject *object,
GAsyncResult *result, GAsyncResult *result,
@ -717,16 +708,15 @@ fetch_uri_sync_on_complete (GObject *object,
} }
gboolean gboolean
_ostree_fetcher_contents_membuf_sync (OstreeFetcher *fetcher, _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
SoupURI *uri, SoupURI *uri,
gboolean add_nul, gboolean add_nul,
gboolean allow_noent, gboolean allow_noent,
GBytes **out_contents, GBytes **out_contents,
GMainLoop *loop, GMainLoop *loop,
gpointer user_data, guint64 max_size,
guint64 max_size, GCancellable *cancellable,
GCancellable *cancellable, GError **error)
GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
const guint8 nulchar = 0; const guint8 nulchar = 0;
@ -740,7 +730,6 @@ _ostree_fetcher_contents_membuf_sync (OstreeFetcher *fetcher,
if (g_cancellable_set_error_if_cancelled (cancellable, error)) if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE; return FALSE;
data.user_data = user_data;
data.loop = loop; data.loop = loop;
data.error = error; data.error = error;
@ -749,7 +738,7 @@ _ostree_fetcher_contents_membuf_sync (OstreeFetcher *fetcher,
cancellable, cancellable,
fetch_uri_sync_on_complete, &data); fetch_uri_sync_on_complete, &data);
run_mainloop_monitor_fetcher (&data); g_main_loop_run (loop);
if (!data.result_stream) if (!data.result_stream)
{ {
if (allow_noent) if (allow_noent)

View File

@ -76,16 +76,15 @@ GFile *_ostree_fetcher_request_uri_with_partial_finish (OstreeFetcher *self,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
gboolean _ostree_fetcher_contents_membuf_sync (OstreeFetcher *fetcher, gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
SoupURI *uri, SoupURI *uri,
gboolean add_nul, gboolean add_nul,
gboolean allow_noent, gboolean allow_noent,
GBytes **out_contents, GBytes **out_contents,
GMainLoop *loop, GMainLoop *loop,
gpointer user_data, guint64 max_size,
guint64 max_size, GCancellable *cancellable,
GCancellable *cancellable, GError **error);
GError **error);
G_END_DECLS G_END_DECLS
#endif #endif

View File

@ -691,16 +691,15 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
g_task_set_task_data (task, request, ostree_metalink_request_unref); g_task_set_task_data (task, request, ostree_metalink_request_unref);
if (! _ostree_fetcher_contents_membuf_sync (self->fetcher, if (! _ostree_fetcher_request_uri_to_membuf (self->fetcher,
self->uri, self->uri,
FALSE, FALSE,
FALSE, FALSE,
&out_contents, &out_contents,
loop, loop,
NULL, self->max_size,
self->max_size, cancellable,
cancellable, error))
error))
goto out; goto out;
if (! on_metalink_bytes_read (request, request, &data, out_contents, error)) if (! on_metalink_bytes_read (request, request, &data, out_contents, error))

View File

@ -258,16 +258,15 @@ fetch_uri_contents_membuf_sync (OtPullData *pull_data,
{ {
gboolean ret; gboolean ret;
pull_data->fetching_sync_uri = uri; pull_data->fetching_sync_uri = uri;
ret = _ostree_fetcher_contents_membuf_sync (pull_data->fetcher, ret = _ostree_fetcher_request_uri_to_membuf (pull_data->fetcher,
uri, uri,
add_nul, add_nul,
allow_noent, allow_noent,
out_contents, out_contents,
pull_data->loop, pull_data->loop,
pull_data, OSTREE_MAX_METADATA_SIZE,
OSTREE_MAX_METADATA_SIZE, cancellable,
cancellable, error);
error);
pull_data->fetching_sync_uri = NULL; pull_data->fetching_sync_uri = NULL;
return ret; return ret;
} }