From 0ce7ab382769d63f12370e8325c40e1f997006fd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 28 Mar 2017 22:39:58 -0400 Subject: [PATCH] libutil: Delete unused GVariant I/O functions These are dead due to fd-relative porting probably. Closes: #767 Approved by: jlebon --- src/libotutil/ot-variant-utils.c | 67 -------------------------------- src/libotutil/ot-variant-utils.h | 12 ------ 2 files changed, 79 deletions(-) diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index 1c4c5efa..c8c049fb 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -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) { diff --git a/src/libotutil/ot-variant-utils.h b/src/libotutil/ot-variant-utils.h index 8a33cf60..4f2131ee 100644 --- a/src/libotutil/ot-variant-utils.h +++ b/src/libotutil/ot-variant-utils.h @@ -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,