From: Ryan Lortie Date: Thu, 10 Jun 2010 17:34:56 +0000 (-0400) Subject: drop "options" support X-Git-Tag: 2.27.93~13^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a8cba9eb53f105b752aac7bb16c7c83c6617caf;p=platform%2Fupstream%2Fglib.git drop "options" support --- diff --git a/gvdb-builder.c b/gvdb-builder.c index 5a71970..fdd0ef4 100644 --- a/gvdb-builder.c +++ b/gvdb-builder.c @@ -36,7 +36,6 @@ struct _GvdbItem GvdbItem *parent; GvdbItem *sibling; GvdbItem *next; - GVariant *options; /* one of: * this: @@ -60,9 +59,6 @@ gvdb_item_free (gpointer data) if (item->value) g_variant_unref (item->value); - if (item->options) - g_variant_unref (item->options); - if (item->table) g_hash_table_unref (item->table); @@ -136,15 +132,6 @@ gvdb_item_set_value (GvdbItem *item, } void -gvdb_item_set_options (GvdbItem *item, - GVariant *options) -{ - g_return_if_fail (!item->options); - - item->options = g_variant_ref_sink (options); -} - -void gvdb_item_set_hash_table (GvdbItem *item, GHashTable *table) { @@ -282,33 +269,6 @@ file_builder_add_value (FileBuilder *fb, } static void -file_builder_add_options (FileBuilder *fb, - GVariant *options, - struct gvdb_pointer *pointer) -{ - GVariant *normal; - gpointer data; - gsize size; - - if (options) - { - if (fb->byteswap) - { - options = g_variant_byteswap (options); - normal = g_variant_get_normal_form (options); - g_variant_unref (options); - } - else - normal = g_variant_get_normal_form (options); - - size = g_variant_get_size (normal); - data = file_builder_allocate (fb, 8, size, pointer); - g_variant_store (normal, data); - g_variant_unref (normal); - } -} - -static void file_builder_add_string (FileBuilder *fb, const gchar *string, guint32_le *start, @@ -424,7 +384,6 @@ file_builder_add_hash (FileBuilder *fb, g_assert (item->child == NULL && item->table == NULL); file_builder_add_value (fb, item->value, &entry->value.pointer); - file_builder_add_options (fb, item->options, &entry->options); entry->type = 'v'; } diff --git a/gvdb-builder.h b/gvdb-builder.h index c0d3b30..797626e 100644 --- a/gvdb-builder.h +++ b/gvdb-builder.h @@ -42,9 +42,6 @@ G_GNUC_INTERNAL void gvdb_item_set_value (GvdbItem *item, GVariant *value); G_GNUC_INTERNAL -void gvdb_item_set_options (GvdbItem *item, - GVariant *options); -G_GNUC_INTERNAL void gvdb_item_set_hash_table (GvdbItem *item, GHashTable *table); G_GNUC_INTERNAL diff --git a/gvdb-format.h b/gvdb-format.h index f11a033..886aa56 100644 --- a/gvdb-format.h +++ b/gvdb-format.h @@ -51,8 +51,6 @@ struct gvdb_hash_item { struct gvdb_pointer pointer; gchar direct[8]; } value; - - struct gvdb_pointer options; }; struct gvdb_header { diff --git a/gvdb-reader.c b/gvdb-reader.c index 54bad9d..699fddb 100644 --- a/gvdb-reader.c +++ b/gvdb-reader.c @@ -422,7 +422,6 @@ gvdb_table_value_from_item (GvdbTable *table, * gvdb_table_get_value: * @file: a #GvdbTable * @key: a string - * @options: a pointer to a #GVariant, or %NULL * @returns: a #GVariant, or %NULL * * Looks up a value named @key in @file. @@ -431,46 +430,19 @@ gvdb_table_value_from_item (GvdbTable *table, * #GVariant instance is returned. The #GVariant does not depend on the * continued existence of @file. * - * If @options is non-%NULL then it will be set either to %NULL in the - * case of no options or a #GVariant containing a dictionary mapping - * strings to variants. - * * You should call g_variant_unref() on the return result when you no * longer require it. **/ GVariant * gvdb_table_get_value (GvdbTable *file, - const gchar *key, - GVariant **options) + const gchar *key) { const struct gvdb_hash_item *item; - GVariant *value; if ((item = gvdb_table_lookup (file, key, 'v')) == NULL) return NULL; - value = gvdb_table_value_from_item (file, item); - - if (options != NULL) - { - gconstpointer data; - gsize size; - - data = gvdb_table_dereference (file, &item->options, 8, &size); - - if (data != NULL && size > 0) - { - *options = g_variant_new_from_data (G_VARIANT_TYPE ("a{sv}"), - data, size, file->trusted, - (GDestroyNotify) g_mapped_file_unref, - g_mapped_file_ref (file->mapped)); - g_variant_ref_sink (*options); - } - else - *options = NULL; - } - - return value; + return gvdb_table_value_from_item (file, item); } /** diff --git a/gvdb-reader.h b/gvdb-reader.h index 2698e6c..a29c16e 100644 --- a/gvdb-reader.h +++ b/gvdb-reader.h @@ -43,8 +43,7 @@ GvdbTable * gvdb_table_get_table (GvdbTab const gchar *key); G_GNUC_INTERNAL GVariant * gvdb_table_get_value (GvdbTable *table, - const gchar *key, - GVariant **options); + const gchar *key); G_GNUC_INTERNAL gboolean gvdb_table_has_value (GvdbTable *table,