mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-22 06:50:47 +03:00
libutil: Delete unused GVariant I/O functions
These are dead due to fd-relative porting probably. Closes: #767 Approved by: jlebon
This commit is contained in:
parent
2571e21b41
commit
0ce7ab3827
@ -80,36 +80,6 @@ ot_util_variant_asv_to_hash_table (GVariant *variant)
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_util_variant_save (GFile *dest,
|
||||
GVariant *variant,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GOutputStream) out = NULL;
|
||||
gsize bytes_written;
|
||||
|
||||
out = (GOutputStream*)g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
cancellable, error);
|
||||
if (!out)
|
||||
goto out;
|
||||
|
||||
if (!g_output_stream_write_all (out,
|
||||
g_variant_get_data (variant),
|
||||
g_variant_get_size (variant),
|
||||
&bytes_written,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
if (!g_output_stream_close (out, cancellable, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
ot_util_variant_take_ref (GVariant *variant)
|
||||
{
|
||||
@ -198,43 +168,6 @@ ot_util_variant_map_fd (int fd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read all input from @src, allocating a new #GVariant from it into
|
||||
* output variable @out_variant. @src will be closed as a result.
|
||||
*
|
||||
* Note the returned @out_variant is not floating.
|
||||
*/
|
||||
gboolean
|
||||
ot_util_variant_from_stream (GInputStream *src,
|
||||
const GVariantType *type,
|
||||
gboolean trusted,
|
||||
GVariant **out_variant,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GMemoryOutputStream) data_stream = NULL;
|
||||
g_autoptr(GVariant) ret_variant = NULL;
|
||||
|
||||
data_stream = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
|
||||
|
||||
if (g_output_stream_splice ((GOutputStream*)data_stream, src,
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
cancellable, error) < 0)
|
||||
goto out;
|
||||
|
||||
ret_variant = g_variant_new_from_data (type, g_memory_output_stream_get_data (data_stream),
|
||||
g_memory_output_stream_get_data_size (data_stream),
|
||||
trusted, (GDestroyNotify) g_object_unref, data_stream);
|
||||
data_stream = NULL; /* Transfer ownership */
|
||||
g_variant_ref_sink (ret_variant);
|
||||
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_variant, &ret_variant);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
GInputStream *
|
||||
ot_variant_read (GVariant *variant)
|
||||
{
|
||||
|
@ -37,11 +37,6 @@ GHashTable *ot_util_variant_asv_to_hash_table (GVariant *variant);
|
||||
|
||||
GVariant * ot_util_variant_take_ref (GVariant *variant);
|
||||
|
||||
gboolean ot_util_variant_save (GFile *dest,
|
||||
GVariant *variant,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
typedef enum {
|
||||
OT_VARIANT_MAP_TRUSTED = (1 << 0),
|
||||
OT_VARIANT_MAP_ALLOW_NOENT = (1 << 1)
|
||||
@ -61,13 +56,6 @@ gboolean ot_util_variant_map_fd (int fd,
|
||||
GVariant **out_variant,
|
||||
GError **error);
|
||||
|
||||
gboolean ot_util_variant_from_stream (GInputStream *src,
|
||||
const GVariantType *type,
|
||||
gboolean trusted,
|
||||
GVariant **out_variant,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
GInputStream *ot_variant_read (GVariant *variant);
|
||||
|
||||
GVariantBuilder *ot_util_variant_builder_from_variant (GVariant *variant,
|
||||
|
Loading…
x
Reference in New Issue
Block a user