[ostree] core: Only depend on GLib 2.30
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Only depend on GLib 2.30
- Date: Mon, 2 Apr 2012 22:33:56 +0000 (UTC)
commit b971ce0dfaa96bbdf3500a7bb820e2103f909210
Author: Colin Walters <walters verbum org>
Date: Mon Apr 2 13:42:09 2012 -0400
core: Only depend on GLib 2.30
src/libostree/ostree-core.c | 3 +--
src/libostree/ostree-repo.c | 2 +-
src/libotutil/ot-variant-utils.c | 13 +++++++++++++
src/libotutil/ot-variant-utils.h | 3 +++
src/ostree/ot-builtin-pack.c | 4 +---
5 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 1e3a9e1..7d6849a 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -680,8 +680,7 @@ ostree_checksum_to_bytes (const char *sha256)
result[i] = (big << 4) | little;
}
- return g_variant_new_fixed_array (G_VARIANT_TYPE ("y"),
- (guchar*)result, 32, 1);
+ return ot_gvariant_new_bytearray ((guchar*)result, 32);
}
char *
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 1461869..69e4207 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1780,7 +1780,7 @@ create_index_bloom (OstreeRepo *self,
/* TODO - define and compute bloom filter */
- ret_bloom = g_variant_new_fixed_array (G_VARIANT_TYPE ("y"), NULL, 0, 1);
+ ret_bloom = ot_gvariant_new_bytearray (NULL, 0);
g_variant_ref_sink (ret_bloom);
ret = TRUE;
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 73cadca..655fd5f 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -28,6 +28,19 @@
#include "otutil.h"
+GVariant *
+ot_gvariant_new_bytearray (const guchar *data,
+ gsize len)
+{
+ gpointer data_copy;
+ GVariant *ret;
+
+ data_copy = g_memdup (data, len);
+ ret = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data_copy,
+ len, FALSE, g_free, data_copy);
+ return ret;
+}
+
GHashTable *
ot_util_variant_asv_to_hash_table (GVariant *variant)
{
diff --git a/src/libotutil/ot-variant-utils.h b/src/libotutil/ot-variant-utils.h
index e443a74..4988253 100644
--- a/src/libotutil/ot-variant-utils.h
+++ b/src/libotutil/ot-variant-utils.h
@@ -45,6 +45,9 @@ G_BEGIN_DECLS
*a_v = NULL; \
} while (0);
+GVariant *ot_gvariant_new_bytearray (const guchar *data,
+ gsize len);
+
GHashTable *ot_util_variant_asv_to_hash_table (GVariant *variant);
GVariant * ot_util_variant_take_ref (GVariant *variant);
diff --git a/src/ostree/ot-builtin-pack.c b/src/ostree/ot-builtin-pack.c
index cdef0f0..0047415 100644
--- a/src/ostree/ot-builtin-pack.c
+++ b/src/ostree/ot-builtin-pack.c
@@ -415,9 +415,7 @@ create_pack_file (OtRepackData *data,
packed_object = g_variant_new ("(uy ay@ay)", GUINT32_TO_BE ((guint32)objtype),
entry_flags,
ostree_checksum_to_bytes (checksum),
- g_variant_new_fixed_array (G_VARIANT_TYPE ("y"),
- data, data_len,
- 1));
+ ot_gvariant_new_bytearray (data, data_len));
g_clear_object (&object_data_stream);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]