[ostree] libotutil: Make use of GBytes in ot_variant_read()



commit c77908bf514d61e75798932f61b5b414d9e36a3c
Author: Colin Walters <walters verbum org>
Date:   Wed Aug 14 19:54:30 2013 -0400

    libotutil: Make use of GBytes in ot_variant_read()
    
    This is just cleaner; we avoid using GObject data, etc.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706031

 src/libotutil/ot-variant-utils.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 0f2e57d..0bc9934 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -180,12 +180,12 @@ GInputStream *
 ot_variant_read (GVariant             *variant)
 {
   GMemoryInputStream *ret = NULL;
+  gs_unref_bytes GBytes *bytes = NULL;
+
+  bytes = g_variant_get_data_as_bytes (variant);
+  ret = (GMemoryInputStream*)g_memory_input_stream_new ();
+  g_memory_input_stream_add_bytes (ret, bytes);
 
-  ret = (GMemoryInputStream*)g_memory_input_stream_new_from_data (g_variant_get_data (variant),
-                                                                  g_variant_get_size (variant),
-                                                                  NULL);
-  g_object_set_data_full ((GObject*)ret, "ot-variant-data",
-                          g_variant_ref (variant), (GDestroyNotify) g_variant_unref);
   return (GInputStream*)ret;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]