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

View File

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

View File

@ -691,16 +691,15 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
g_task_set_task_data (task, request, ostree_metalink_request_unref);
if (! _ostree_fetcher_contents_membuf_sync (self->fetcher,
self->uri,
FALSE,
FALSE,
&out_contents,
loop,
NULL,
self->max_size,
cancellable,
error))
if (! _ostree_fetcher_request_uri_to_membuf (self->fetcher,
self->uri,
FALSE,
FALSE,
&out_contents,
loop,
self->max_size,
cancellable,
error))
goto out;
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;
pull_data->fetching_sync_uri = uri;
ret = _ostree_fetcher_contents_membuf_sync (pull_data->fetcher,
uri,
add_nul,
allow_noent,
out_contents,
pull_data->loop,
pull_data,
OSTREE_MAX_METADATA_SIZE,
cancellable,
error);
ret = _ostree_fetcher_request_uri_to_membuf (pull_data->fetcher,
uri,
add_nul,
allow_noent,
out_contents,
pull_data->loop,
OSTREE_MAX_METADATA_SIZE,
cancellable,
error);
pull_data->fetching_sync_uri = NULL;
return ret;
}