mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	drop "options" support
This commit is contained in:
		@@ -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);
 | 
			
		||||
 | 
			
		||||
@@ -135,15 +131,6 @@ gvdb_item_set_value (GvdbItem *item,
 | 
			
		||||
  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
 | 
			
		||||
gvdb_item_set_hash_table (GvdbItem   *item,
 | 
			
		||||
                          GHashTable *table)
 | 
			
		||||
@@ -281,33 +268,6 @@ file_builder_add_value (FileBuilder         *fb,
 | 
			
		||||
  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
 | 
			
		||||
file_builder_add_string (FileBuilder *fb,
 | 
			
		||||
                         const gchar *string,
 | 
			
		||||
@@ -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';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -51,8 +51,6 @@ struct gvdb_hash_item {
 | 
			
		||||
    struct gvdb_pointer pointer;
 | 
			
		||||
    gchar direct[8];
 | 
			
		||||
  } value;
 | 
			
		||||
 | 
			
		||||
  struct gvdb_pointer options;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct gvdb_header {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user