mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-31 12:53:07 +02:00
drop "options" support
This commit is contained in:
parent
5215d4b6d3
commit
9a8cba9eb5
@ -36,7 +36,6 @@ struct _GvdbItem
|
|||||||
GvdbItem *parent;
|
GvdbItem *parent;
|
||||||
GvdbItem *sibling;
|
GvdbItem *sibling;
|
||||||
GvdbItem *next;
|
GvdbItem *next;
|
||||||
GVariant *options;
|
|
||||||
|
|
||||||
/* one of:
|
/* one of:
|
||||||
* this:
|
* this:
|
||||||
@ -60,9 +59,6 @@ gvdb_item_free (gpointer data)
|
|||||||
if (item->value)
|
if (item->value)
|
||||||
g_variant_unref (item->value);
|
g_variant_unref (item->value);
|
||||||
|
|
||||||
if (item->options)
|
|
||||||
g_variant_unref (item->options);
|
|
||||||
|
|
||||||
if (item->table)
|
if (item->table)
|
||||||
g_hash_table_unref (item->table);
|
g_hash_table_unref (item->table);
|
||||||
|
|
||||||
@ -135,15 +131,6 @@ gvdb_item_set_value (GvdbItem *item,
|
|||||||
item->value = g_variant_ref_sink (value);
|
item->value = g_variant_ref_sink (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gvdb_item_set_options (GvdbItem *item,
|
|
||||||
GVariant *options)
|
|
||||||
{
|
|
||||||
g_return_if_fail (!item->options);
|
|
||||||
|
|
||||||
item->options = g_variant_ref_sink (options);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gvdb_item_set_hash_table (GvdbItem *item,
|
gvdb_item_set_hash_table (GvdbItem *item,
|
||||||
GHashTable *table)
|
GHashTable *table)
|
||||||
@ -281,33 +268,6 @@ file_builder_add_value (FileBuilder *fb,
|
|||||||
g_variant_unref (normal);
|
g_variant_unref (normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
static void
|
||||||
file_builder_add_string (FileBuilder *fb,
|
file_builder_add_string (FileBuilder *fb,
|
||||||
const gchar *string,
|
const gchar *string,
|
||||||
@ -424,7 +384,6 @@ file_builder_add_hash (FileBuilder *fb,
|
|||||||
g_assert (item->child == NULL && item->table == NULL);
|
g_assert (item->child == NULL && item->table == NULL);
|
||||||
|
|
||||||
file_builder_add_value (fb, item->value, &entry->value.pointer);
|
file_builder_add_value (fb, item->value, &entry->value.pointer);
|
||||||
file_builder_add_options (fb, item->options, &entry->options);
|
|
||||||
entry->type = 'v';
|
entry->type = 'v';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,6 @@ G_GNUC_INTERNAL
|
|||||||
void gvdb_item_set_value (GvdbItem *item,
|
void gvdb_item_set_value (GvdbItem *item,
|
||||||
GVariant *value);
|
GVariant *value);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void gvdb_item_set_options (GvdbItem *item,
|
|
||||||
GVariant *options);
|
|
||||||
G_GNUC_INTERNAL
|
|
||||||
void gvdb_item_set_hash_table (GvdbItem *item,
|
void gvdb_item_set_hash_table (GvdbItem *item,
|
||||||
GHashTable *table);
|
GHashTable *table);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
@ -51,8 +51,6 @@ struct gvdb_hash_item {
|
|||||||
struct gvdb_pointer pointer;
|
struct gvdb_pointer pointer;
|
||||||
gchar direct[8];
|
gchar direct[8];
|
||||||
} value;
|
} value;
|
||||||
|
|
||||||
struct gvdb_pointer options;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gvdb_header {
|
struct gvdb_header {
|
||||||
|
@ -422,7 +422,6 @@ gvdb_table_value_from_item (GvdbTable *table,
|
|||||||
* gvdb_table_get_value:
|
* gvdb_table_get_value:
|
||||||
* @file: a #GvdbTable
|
* @file: a #GvdbTable
|
||||||
* @key: a string
|
* @key: a string
|
||||||
* @options: a pointer to a #GVariant, or %NULL
|
|
||||||
* @returns: a #GVariant, or %NULL
|
* @returns: a #GVariant, or %NULL
|
||||||
*
|
*
|
||||||
* Looks up a value named @key in @file.
|
* 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
|
* #GVariant instance is returned. The #GVariant does not depend on the
|
||||||
* continued existence of @file.
|
* 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
|
* You should call g_variant_unref() on the return result when you no
|
||||||
* longer require it.
|
* longer require it.
|
||||||
**/
|
**/
|
||||||
GVariant *
|
GVariant *
|
||||||
gvdb_table_get_value (GvdbTable *file,
|
gvdb_table_get_value (GvdbTable *file,
|
||||||
const gchar *key,
|
const gchar *key)
|
||||||
GVariant **options)
|
|
||||||
{
|
{
|
||||||
const struct gvdb_hash_item *item;
|
const struct gvdb_hash_item *item;
|
||||||
GVariant *value;
|
|
||||||
|
|
||||||
if ((item = gvdb_table_lookup (file, key, 'v')) == NULL)
|
if ((item = gvdb_table_lookup (file, key, 'v')) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value = gvdb_table_value_from_item (file, item);
|
return 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,8 +43,7 @@ GvdbTable * gvdb_table_get_table (GvdbTab
|
|||||||
const gchar *key);
|
const gchar *key);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GVariant * gvdb_table_get_value (GvdbTable *table,
|
GVariant * gvdb_table_get_value (GvdbTable *table,
|
||||||
const gchar *key,
|
const gchar *key);
|
||||||
GVariant **options);
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean gvdb_table_has_value (GvdbTable *table,
|
gboolean gvdb_table_has_value (GvdbTable *table,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user