diff options
author | Ryan Lortie <desrt@desrt.ca> | 2010-06-10 13:35:25 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2010-06-10 13:35:25 -0400 |
commit | 73007021796f33d7ccec4e5f2bb2b2f8660347f2 (patch) | |
tree | 985767d3d149ee09617b5fd16d7dc91c845acdb2 /gio/gvdb/gvdb-builder.c | |
parent | 45e604d029980f90a7304b6311fc43cc0cc2ab69 (diff) | |
parent | 9a8cba9eb53f105b752aac7bb16c7c83c6617caf (diff) |
Merge remote branch 'gvdb/master'
Diffstat (limited to 'gio/gvdb/gvdb-builder.c')
-rw-r--r-- | gio/gvdb/gvdb-builder.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/gio/gvdb/gvdb-builder.c b/gio/gvdb/gvdb-builder.c index 7cca13f9d..fdd0ef4c9 100644 --- a/gio/gvdb/gvdb-builder.c +++ b/gio/gvdb/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) { @@ -178,7 +165,7 @@ typedef struct gint n_buckets; } HashTable; -HashTable * +static HashTable * hash_table_new (gint n_buckets) { HashTable *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,13 +384,12 @@ 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'; } if (item->child != NULL) { - guint32 children = 0; + guint32 children = 0, i = 0; guint32_le *offsets; GvdbItem *child; @@ -444,9 +403,9 @@ file_builder_add_hash (FileBuilder *fb, entry->type = 'L'; for (child = item->child; child; child = child->sibling) - offsets[--children] = child->assigned_index; + offsets[i++] = child->assigned_index; - g_assert (children == 0); + g_assert (children == i); } if (item->table != NULL) |