[glib/gsettings] GVariant: 'struct' is now 'tuple'
- From: Ryan Lortie <ryanl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib/gsettings] GVariant: 'struct' is now 'tuple'
- Date: Fri, 4 Sep 2009 16:21:31 +0000 (UTC)
commit e9c7f59a6d7875af6fa0fa27bd98460dafef0abe
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Sep 4 11:56:42 2009 -0400
GVariant: 'struct' is now 'tuple'
docs/reference/glib/glib-sections.txt | 2 +-
glib/glib.symbols | 2 +-
glib/gvariant-core.c | 8 +-
glib/gvariant-markup.c | 4 +-
glib/gvariant-parser.c | 2 +-
glib/gvariant-printer.c | 2 +-
glib/gvariant-serialiser.c | 16 +++---
glib/gvariant-util.c | 28 +++++-----
glib/gvariant-valist.c | 2 +-
glib/gvarianttype.c | 64 +++++++++++-----------
glib/gvarianttype.h | 20 +++---
glib/gvarianttypeinfo.c | 100 ++++++++++++++++----------------
12 files changed, 125 insertions(+), 125 deletions(-)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index b517490..f814dde 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -2750,7 +2750,7 @@ g_variant_type_matches
g_variant_type_new_maybe
g_variant_type_new_array
GVariantTypeGetter
-g_variant_type_new_struct
+g_variant_type_new_tuple
g_variant_type_new_dict_entry
<SUBSECTION>
diff --git a/glib/glib.symbols b/glib/glib.symbols
index 53d32a8..98be8dd 100644
--- a/glib/glib.symbols
+++ b/glib/glib.symbols
@@ -1768,7 +1768,7 @@ g_variant_type_key
g_variant_type_value
g_variant_type_new_array
g_variant_type_new_maybe
-g_variant_type_new_struct_
+g_variant_type_new_tuple_
g_variant_type_new_dict_entry
g_variant_type_check_string_
#endif
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index 5f39d79..641dd18 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -895,13 +895,13 @@ g_variant_get_type (GVariant *value)
* @returns: the number of children in the container
*
* Determines the number of children in a container #GVariant
- * instance. This includes variants, maybes, arrays, structures and
+ * instance. This includes variants, maybes, arrays, tuples and
* dictionary entries. It is an error to call this function on any
* other type of #GVariant.
*
* For variants, the return value is always 1. For maybes, it is
* always zero or one. For arrays, it is the length of the array.
- * For structures it is the number of structure items (which depends
+ * For tuples it is the number of tuple items (which depends
* only on the type). For dictionary entries, it is always 2.
*
* This function never fails.
@@ -940,7 +940,7 @@ g_variant_n_children (GVariant *value)
* @returns: the child at the specified index
*
* Reads a child item out of a container #GVariant instance. This
- * includes variants, maybes, arrays, structures and dictionary
+ * includes variants, maybes, arrays, tuple and dictionary
* entries. It is an error to call this function on any other type of
* #GVariant.
*
@@ -1178,7 +1178,7 @@ g_variant_get_fixed (GVariant *value,
*
* Gets a pointer to the data of an array of fixed sized #GVariant
* instances. This pointer can be treated as a pointer to an array of
- * the equivalent C structure type and accessed directly. The data is
+ * the equivalent C type and accessed directly. The data is
* in machine byte order.
*
* @elem_size must be equal to the fixed size of the element type of
diff --git a/glib/gvariant-markup.c b/glib/gvariant-markup.c
index 7314d77..e135234 100644
--- a/glib/gvariant-markup.c
+++ b/glib/gvariant-markup.c
@@ -182,7 +182,7 @@ g_variant_markup_print_string (GVariant *value,
break;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
{
GVariantIter iter;
@@ -413,7 +413,7 @@ type_class_from_keyword (const char *keyword)
{ G_VARIANT_TYPE_CLASS_MAYBE, "maybe" },
{ G_VARIANT_TYPE_CLASS_MAYBE, "nothing" },
{ G_VARIANT_TYPE_CLASS_ARRAY, "array" },
- { G_VARIANT_TYPE_CLASS_STRUCT, "struct" },
+ { G_VARIANT_TYPE_CLASS_TUPLE, "struct" },
{ G_VARIANT_TYPE_CLASS_DICT_ENTRY, "dictionary-entry" }
};
gint i;
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index c4d9a21..063d264 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -762,7 +762,7 @@ tuple_get_value (AST *ast,
GVariantBuilder *builder;
gint i;
- builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_STRUCT, type);
+ builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_TUPLE, type);
childtype = g_variant_type_first (type);
for (i = 0; i < tuple->n_children; i++)
diff --git a/glib/gvariant-printer.c b/glib/gvariant-printer.c
index 249090a..97c4266 100644
--- a/glib/gvariant-printer.c
+++ b/glib/gvariant-printer.c
@@ -114,7 +114,7 @@ g_variant_print_string (GVariant *value,
break;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
{
GVariantIter iter;
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index 03a4592..6b27a55 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -152,7 +152,7 @@ g_variant_serialised_n_children (GVariantSerialised container)
case G_VARIANT_TYPE_CLASS_VARIANT:
return 1;
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
return g_variant_type_info_n_members (container.type);
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
@@ -402,7 +402,7 @@ g_variant_serialised_get_child (GVariantSerialised container,
return child;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
{
const GVariantMemberInfo *info;
@@ -590,7 +590,7 @@ g_variant_serialiser_serialise (GVariantSerialised container,
return;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
{
if (n_children)
@@ -750,7 +750,7 @@ g_variant_serialiser_needed_size (GVariantTypeInfo *type,
return fixed_size * n_children;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
{
gsize n_offsets;
@@ -802,8 +802,8 @@ g_variant_serialiser_needed_size (GVariantTypeInfo *type,
}
}
- /* no need to pad fixed-sized structures here because
- * fixed sized structures are taken care of directly.
+ /* no need to pad fixed-sized tuples here because
+ * fixed sized tuples are taken care of directly.
*/
return g_variant_serialiser_determine_size (offset, n_offsets, FALSE);
@@ -832,7 +832,7 @@ g_variant_serialised_byteswap (GVariantSerialised value)
/* if fixed size and alignment are equal then we are down
* to the base integer type and we should swap it. the
- * only exception to this is if we have a struct with a
+ * only exception to this is if we have a tuple with a
* single item, and then swapping it will be OK anyway.
*/
if (alignment + 1 == fixed_size)
@@ -1121,7 +1121,7 @@ g_variant_serialised_is_normal (GVariantSerialised value)
return TRUE;
}
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
{
const GVariantMemberInfo *info;
diff --git a/glib/gvariant-util.c b/glib/gvariant-util.c
index 14d4cde..5b3e6b5 100644
--- a/glib/gvariant-util.c
+++ b/glib/gvariant-util.c
@@ -958,12 +958,12 @@ g_variant_builder_add_value (GVariantBuilder *builder,
builder->trusted &= g_variant_is_trusted (value);
if (builder->expected &&
- (builder->class == G_VARIANT_TYPE_CLASS_STRUCT ||
+ (builder->class == G_VARIANT_TYPE_CLASS_TUPLE ||
builder->class == G_VARIANT_TYPE_CLASS_DICT_ENTRY))
builder->expected = g_variant_type_next (builder->expected);
if (builder->expected2 &&
- (builder->class == G_VARIANT_TYPE_CLASS_STRUCT ||
+ (builder->class == G_VARIANT_TYPE_CLASS_TUPLE ||
builder->class == G_VARIANT_TYPE_CLASS_DICT_ENTRY))
builder->expected2 = g_variant_type_next (builder->expected2);
@@ -1024,7 +1024,7 @@ g_variant_builder_open (GVariantBuilder *parent,
class == G_VARIANT_TYPE_CLASS_ARRAY)
child->expected2 = g_variant_type_element (parent->expected2);
- if (class == G_VARIANT_TYPE_CLASS_STRUCT ||
+ if (class == G_VARIANT_TYPE_CLASS_TUPLE ||
class == G_VARIANT_TYPE_CLASS_DICT_ENTRY)
child->expected2 = g_variant_type_first (parent->expected2);
@@ -1141,11 +1141,11 @@ g_variant_builder_new (GVariantTypeClass class,
builder->expected = g_variant_type_key (builder->type);
break;
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
builder->children_allocated = 8;
if (builder->type &&
- g_variant_type_equal (builder->type, G_VARIANT_TYPE_ANY_STRUCT))
+ g_variant_type_equal (builder->type, G_VARIANT_TYPE_ANY_TUPLE))
/* this is useless information. they should have just said NULL */
{
g_variant_type_free (builder->type);
@@ -1234,10 +1234,10 @@ g_variant_builder_end (GVariantBuilder *builder)
g_variant_get_type (builder->children[1]));
break;
- case G_VARIANT_TYPE_CLASS_STRUCT:
- my_type = g_variant_type_new_struct (builder->children,
- g_variant_get_type,
- builder->offset);
+ case G_VARIANT_TYPE_CLASS_TUPLE:
+ my_type = g_variant_type_new_tuple (builder->children,
+ g_variant_get_type,
+ builder->offset);
break;
default:
@@ -1331,7 +1331,7 @@ g_variant_builder_check_end (GVariantBuilder *builder,
}
break;
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
if (builder->expected)
{
gchar *type_string;
@@ -1339,7 +1339,7 @@ g_variant_builder_check_end (GVariantBuilder *builder,
type_string = g_variant_type_dup_string (builder->type);
g_set_error (error, G_VARIANT_BUILDER_ERROR,
G_VARIANT_BUILDER_ERROR_TOO_FEW,
- "a structure of type %s must contain %" G_GSIZE_FORMAT
+ "a tuple of type %s must contain %" G_GSIZE_FORMAT
" children but only %" G_GSIZE_FORMAT
" have been given", type_string,
g_variant_type_n_items (builder->type),
@@ -1541,7 +1541,7 @@ g_variant_builder_check_add (GVariantBuilder *builder,
}
break;
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
if (builder->type && builder->expected == NULL)
{
gchar *type_str;
@@ -1550,7 +1550,7 @@ g_variant_builder_check_add (GVariantBuilder *builder,
g_set_error (error, G_VARIANT_BUILDER_ERROR,
G_VARIANT_BUILDER_ERROR_TOO_MANY,
"too many items (%" G_GSIZE_FORMAT
- ") for this structure type '%s'",
+ ") for this tuple type '%s'",
builder->offset + 1, type_str);
g_free (type_str);
@@ -1788,7 +1788,7 @@ g_variant_deep_copy (GVariant *value)
case G_VARIANT_TYPE_CLASS_MAYBE:
case G_VARIANT_TYPE_CLASS_ARRAY:
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
{
GVariantBuilder *builder;
diff --git a/glib/gvariant-valist.c b/glib/gvariant-valist.c
index 12805d1..ab36713 100644
--- a/glib/gvariant-valist.c
+++ b/glib/gvariant-valist.c
@@ -434,7 +434,7 @@ g_variant_valist_new (const gchar **format_string,
GVariantBuilder *builder;
if (**format_string == '(')
- builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_STRUCT,
+ builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_TUPLE,
NULL);
else
builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_DICT_ENTRY,
diff --git a/glib/gvarianttype.c b/glib/gvarianttype.c
index c2a793f..7d7cf77 100644
--- a/glib/gvarianttype.c
+++ b/glib/gvarianttype.c
@@ -60,9 +60,9 @@
* corresponding to the type of the key, and the second is the one
* corresponding to the type of the value.
*
- * The types that start with '(' and end with ')' are structure types,
+ * The types that start with '(' and end with ')' are tuple types,
* where each type string contained between the brackets corresponds
- * to an item type of that structure type.
+ * to an item type of that tuple type.
*
* Any type that has a type string that can be generated from 'base'
* is in the #GVariantTypeClass %G_VARIANT_TYPE_CLASS_BASIC.
@@ -352,7 +352,7 @@ g_variant_type_is_concrete (const GVariantType *type)
*
* Determines if the given @type is a container type.
*
- * Container types are any array, maybe, structure, or dictionary
+ * Container types are any array, maybe, tuple, or dictionary
* entry types plus the variant type.
*
* This function returns %TRUE for any wildcard type for which every
@@ -561,7 +561,7 @@ g_variant_type_is_in_class (const GVariantType *type,
switch (class)
{
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
return first_char == '(' || first_char == 'r';
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
@@ -601,7 +601,7 @@ g_variant_type_get_class (const GVariantType *type)
switch (first_char)
{
case '(':
- return G_VARIANT_TYPE_CLASS_STRUCT;
+ return G_VARIANT_TYPE_CLASS_TUPLE;
case '{':
return G_VARIANT_TYPE_CLASS_DICT_ENTRY;
@@ -619,7 +619,7 @@ g_variant_type_get_class (const GVariantType *type)
* Determines if @class is a container class.
*
* The following are considered to be container classes: maybe, array,
- * struct, dict_entry and variant.
+ * tuple, dict_entry and variant.
**/
gboolean
g_variant_type_class_is_container (GVariantTypeClass class)
@@ -629,7 +629,7 @@ g_variant_type_class_is_container (GVariantTypeClass class)
case G_VARIANT_TYPE_CLASS_VARIANT:
case G_VARIANT_TYPE_CLASS_MAYBE:
case G_VARIANT_TYPE_CLASS_ARRAY:
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
return TRUE;
@@ -697,16 +697,16 @@ g_variant_type_element (const GVariantType *type)
/**
* g_variant_type_first:
- * @type: a #GVariantType of class struct or dict entry
+ * @type: a #GVariantType of class tuple or dict entry
* @returns: the first item type of @type, or %NULL
*
- * Determines the first item type of a structure or dictionary entry
+ * Determines the first item type of a tuple or dictionary entry
* type.
*
* This function must be called with a type in one of the classes
- * %G_VARIANT_TYPE_CLASS_STRUCT or %G_VARIANT_TYPE_CLASS_DICT_ENTRY
- * but must not be called on the generic structure type
- * %G_VARIANT_TYPE_ANY_STRUCT.
+ * %G_VARIANT_TYPE_CLASS_TUPLE or %G_VARIANT_TYPE_CLASS_DICT_ENTRY
+ * but must not be called on the generic tuple type
+ * %G_VARIANT_TYPE_ANY_TUPLE.
*
* In the case of a dictionary entry type, this returns the type of
* the key.
@@ -714,7 +714,7 @@ g_variant_type_element (const GVariantType *type)
* %NULL is returned in case of @type being %G_VARIANT_TYPE_UNIT.
*
* This call, together with g_variant_type_next() provides an iterator
- * interface over structure and dictionary entry types.
+ * interface over tuple and dictionary entry types.
**/
const GVariantType *
g_variant_type_first (const GVariantType *type)
@@ -734,17 +734,17 @@ g_variant_type_first (const GVariantType *type)
* @type: a #GVariantType
* @returns: the next #GVariantType after @type, or %NULL
*
- * Determines the next item type of a structure or dictionary entry
+ * Determines the next item type of a tuple or dictionary entry
* type.
*
* @type must be the result of a previous call to
* g_variant_type_first(). Together, these two functions provide an
- * iterator interface over structure and dictioanry entry types.
+ * iterator interface over tuple and dictioanry entry types.
*
* If called on the key type of a dictionary entry then this call
* returns the value type.
*
- * %NULL is returned when @type is the last item in a structure or the
+ * %NULL is returned when @type is the last item in a tuple or the
* value type of a dictionary entry.
**/
const GVariantType *
@@ -762,16 +762,16 @@ g_variant_type_next (const GVariantType *type)
/**
* g_variant_type_n_items:
- * @type: a #GVariantType of class struct or dict entry
+ * @type: a #GVariantType of class tuple or dict entry
* @returns: the number of items in @type
*
- * Determines the number of items contained in a structure or
+ * Determines the number of items contained in a tuple or
* dictionary entry type.
*
* This function must be called with a type in one of the classes
- * %G_VARIANT_TYPE_CLASS_STRUCT or %G_VARIANT_TYPE_CLASS_DICT_ENTRY
- * but must not be called on the generic structure type
- * %G_VARIANT_TYPE_ANY_STRUCT.
+ * %G_VARIANT_TYPE_CLASS_TUPLE or %G_VARIANT_TYPE_CLASS_DICT_ENTRY
+ * but must not be called on the generic tuple type
+ * %G_VARIANT_TYPE_ANY_TUPLE.
*
* In the case of a dictionary entry type, this function will always
* return 2.
@@ -836,21 +836,21 @@ g_variant_type_value (const GVariantType *type)
* @returns: a const #GVariantType
*
* A callback function intended for use with
- * g_variant_type_new_struct(). This function's purpose is to extract
+ * g_variant_type_new_tuple(). This function's purpose is to extract
* a #GVariantType from some pointer type. The returned type should
* be owned by whatever is at the end of the pointer because it won't
* be freed.
**/
/**
- * g_variant_type_new_struct:
+ * g_variant_type_new_tuple:
* @items: an array of items, one for each item
* @func: a function to determine each item type
* @length: the length of @items
* @returns: a new #GVariantType
*
- * Constructs a new structure type.
+ * Constructs a new tuple type.
*
- * The item types for the structure type may be provided directly (as
+ * The item types for the tuple type may be provided directly (as
* an array of #GVariantType), in which case @func should be %NULL.
*
* The item types can also be provided indirectly. In this case,
@@ -863,9 +863,9 @@ g_variant_type_value (const GVariantType *type)
* g_variant_type_free().
**/
static GVariantType *
-g_variant_type_new_struct_slow (const gpointer *items,
- GVariantTypeGetter func,
- gsize length)
+g_variant_type_new_tuple_slow (const gpointer *items,
+ GVariantTypeGetter func,
+ gsize length)
{
GString *string;
gsize i;
@@ -890,9 +890,9 @@ g_variant_type_new_struct_slow (const gpointer *items,
}
GVariantType *
-g_variant_type_new_struct_ (const gpointer *items,
- GVariantTypeGetter func,
- gsize length)
+g_variant_type_new_tuple_ (const gpointer *items,
+ GVariantTypeGetter func,
+ gsize length)
{
char buffer[1024];
gsize offset;
@@ -922,7 +922,7 @@ g_variant_type_new_struct_ (const gpointer *items,
size = g_variant_type_get_string_length (type);
if (offset + size >= sizeof buffer) /* leave room for ')' */
- return g_variant_type_new_struct_slow (items, func, length);
+ return g_variant_type_new_tuple_slow (items, func, length);
memcpy (&buffer[offset], type, size);
offset += size;
diff --git a/glib/gvarianttype.h b/glib/gvarianttype.h
index 092685e..2945c3c 100644
--- a/glib/gvarianttype.h
+++ b/glib/gvarianttype.h
@@ -33,7 +33,7 @@ typedef struct OPAQUE_TYPE_GVariantType GVariantType;
* @G_VARIANT_TYPE_CLASS_VARIANT: the class containing the type %G_VARIANT_TYPE_VARIANT
* @G_VARIANT_TYPE_CLASS_MAYBE: the class containing all maybe types
* @G_VARIANT_TYPE_CLASS_ARRAY: the class containing all array types
- * @G_VARIANT_TYPE_CLASS_STRUCT: the class containing all structure types
+ * @G_VARIANT_TYPE_CLASS_TUPLE: the class containing all tuple types
* @G_VARIANT_TYPE_CLASS_DICT_ENTRY: the class containing all dictionary entry types
* @G_VARIANT_TYPE_CLASS_BASIC: the class containing all of the basic types (including %G_VARIANT_TYPE_ANY_BASIC and anything that matches it).
* @G_VARIANT_TYPE_CLASS_ALL: the class containing all types (including %G_VARIANT_TYPE_ANY and anything that matches it).
@@ -74,7 +74,7 @@ typedef enum
G_VARIANT_TYPE_CLASS_MAYBE = 'm',
G_VARIANT_TYPE_CLASS_ARRAY = 'a',
- G_VARIANT_TYPE_CLASS_STRUCT = 'r',
+ G_VARIANT_TYPE_CLASS_TUPLE = 'r',
G_VARIANT_TYPE_CLASS_DICT_ENTRY = 'e',
G_VARIANT_TYPE_CLASS_ALL = '*',
@@ -195,8 +195,8 @@ typedef enum
/**
* G_VARIANT_TYPE_UNIT:
*
- * The empty structure type. Has only one instance. Known also as
- * "triv" or "void".
+ * The empty tuple type. Has only one instance. Known also as "triv"
+ * or "void".
**/
#define G_VARIANT_TYPE_UNIT ((const GVariantType *) "()")
@@ -229,11 +229,11 @@ typedef enum
#define G_VARIANT_TYPE_ANY_ARRAY ((const GVariantType *) "a*")
/**
- * G_VARIANT_TYPE_ANY_STRUCT:
+ * G_VARIANT_TYPE_ANY_TUPLE:
*
- * A wildcard type matching any structure type.
+ * A wildcard type matching any tuple type.
**/
-#define G_VARIANT_TYPE_ANY_STRUCT ((const GVariantType *) "r")
+#define G_VARIANT_TYPE_ANY_TUPLE ((const GVariantType *) "r")
/**
* G_VARIANT_TYPE_ANY_DICT_ENTRY:
@@ -300,7 +300,7 @@ const GVariantType *g_variant_type_value (const G
GVariantType *g_variant_type_new_array (const GVariantType *element);
GVariantType *g_variant_type_new_maybe (const GVariantType *element);
typedef const GVariantType *(*GVariantTypeGetter) (gpointer data);
-GVariantType *g_variant_type_new_struct_ (const gpointer *items,
+GVariantType *g_variant_type_new_tuple_ (const gpointer *items,
GVariantTypeGetter func,
gsize length);
GVariantType *g_variant_type_new_dict_entry (const GVariantType *key,
@@ -314,8 +314,8 @@ G_END_DECLS
#define G_VARIANT_TYPE(type_string) \
(g_variant_type_check_string_ (type_string))
-#define g_variant_type_new_struct(items, func, length) \
- (g_variant_type_new_struct_ ((const gpointer *) items, (GVariantTypeGetter) (1 ? func : \
+#define g_variant_type_new_tuple(items, func, length) \
+ (g_variant_type_new_tuple_ ((const gpointer *) items, (GVariantTypeGetter) (1 ? func : \
(const GVariantType *(*)(typeof (items[0]))) NULL), length))
#endif /* _gvarianttype_h_ */
diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c
index f634888..a383ecc 100644
--- a/glib/gvarianttypeinfo.c
+++ b/glib/gvarianttypeinfo.c
@@ -37,7 +37,7 @@ typedef struct
GVariantMemberInfo *members;
gsize n_members;
-} StructInfo;
+} TupleInfo;
/* == query == */
const GVariantType *
@@ -126,33 +126,33 @@ g_variant_type_info_query_element (GVariantTypeInfo *info,
alignment, fixed_size);
}
-/* == structure == */
-#define STRUCT_INFO_CLASS 's'
-static StructInfo *
-STRUCT_INFO (GVariantTypeInfo *info)
+/* == tupleure == */
+#define TUPLE_INFO_CLASS 's'
+static TupleInfo *
+TUPLE_INFO (GVariantTypeInfo *info)
{
- g_assert (info->info_class == STRUCT_INFO_CLASS);
- return (StructInfo *) info;
+ g_assert (info->info_class == TUPLE_INFO_CLASS);
+ return (TupleInfo *) info;
}
static void
-struct_info_free (GVariantTypeInfo *info)
+tuple_info_free (GVariantTypeInfo *info)
{
- StructInfo *struct_info = STRUCT_INFO (info);
+ TupleInfo *tuple_info = TUPLE_INFO (info);
gint i;
- for (i = 0; i < struct_info->n_members; i++)
- g_variant_type_info_unref (struct_info->members[i].type);
+ for (i = 0; i < tuple_info->n_members; i++)
+ g_variant_type_info_unref (tuple_info->members[i].type);
- g_slice_free1 (sizeof (GVariantMemberInfo) * struct_info->n_members,
- struct_info->members);
- g_slice_free (StructInfo, struct_info);
+ g_slice_free1 (sizeof (GVariantMemberInfo) * tuple_info->n_members,
+ tuple_info->members);
+ g_slice_free (TupleInfo, tuple_info);
}
static void
-struct_allocate_members (const GVariantType *type,
- GVariantMemberInfo **members,
- gsize *n_members)
+tuple_allocate_members (const GVariantType *type,
+ GVariantMemberInfo **members,
+ gsize *n_members)
{
const GVariantType *item_type;
gsize i = 0;
@@ -171,10 +171,10 @@ struct_allocate_members (const GVariantType *type,
}
static gboolean
-struct_get_item (StructInfo *info,
- GVariantMemberInfo *item,
- gsize *d,
- gsize *e)
+tuple_get_item (TupleInfo *info,
+ GVariantMemberInfo *item,
+ gsize *d,
+ gsize *e)
{
if (&info->members[info->n_members] == item)
return FALSE;
@@ -185,11 +185,11 @@ struct_get_item (StructInfo *info,
}
static void
-struct_table_append (GVariantMemberInfo **items,
- gsize i,
- gsize a,
- gsize b,
- gsize c)
+tuple_table_append (GVariantMemberInfo **items,
+ gsize i,
+ gsize a,
+ gsize b,
+ gsize c)
{
GVariantMemberInfo *item = (*items)++;
@@ -208,27 +208,27 @@ struct_table_append (GVariantMemberInfo **items,
}
static gsize
-struct_align (gsize offset,
- guint alignment)
+tuple_align (gsize offset,
+ guint alignment)
{
return offset + ((-offset) & alignment);
}
static void
-struct_generate_table (StructInfo *info)
+tuple_generate_table (TupleInfo *info)
{
GVariantMemberInfo *items = info->members;
gsize i = -1, a = 0, b = 0, c = 0, d, e;
/* §4.1.2 */
- while (struct_get_item (info, items, &d, &e))
+ while (tuple_get_item (info, items, &d, &e))
{
if (d <= b)
- c = struct_align (c, d);
+ c = tuple_align (c, d);
else
- a += struct_align (c, b), b = d, c = 0;
+ a += tuple_align (c, b), b = d, c = 0;
- struct_table_append (&items, i, a, b, c);
+ tuple_table_append (&items, i, a, b, c);
if (e == 0)
i++, a = b = c = 0;
@@ -238,7 +238,7 @@ struct_generate_table (StructInfo *info)
}
static void
-struct_set_self_info (StructInfo *info)
+tuple_set_self_info (TupleInfo *info)
{
if (info->n_members > 0)
{
@@ -250,7 +250,7 @@ struct_set_self_info (StructInfo *info)
m--;
if (m->i == -1 && m->type->fixed_size)
- info->self.fixed_size = struct_align (((m->a & m->b) | m->c) + m->type->fixed_size,
+ info->self.fixed_size = tuple_align (((m->a & m->b) | m->c) + m->type->fixed_size,
info->self.alignment);
else
info->self.fixed_size = 0;
@@ -263,16 +263,16 @@ struct_set_self_info (StructInfo *info)
}
static GVariantTypeInfo *
-struct_info_new (const GVariantType *type)
+tuple_info_new (const GVariantType *type)
{
- StructInfo *info;
+ TupleInfo *info;
- info = g_slice_new (StructInfo);
- info->self.info_class = STRUCT_INFO_CLASS;
+ info = g_slice_new (TupleInfo);
+ info->self.info_class = TUPLE_INFO_CLASS;
- struct_allocate_members (type, &info->members, &info->n_members);
- struct_generate_table (info);
- struct_set_self_info (info);
+ tuple_allocate_members (type, &info->members, &info->n_members);
+ tuple_generate_table (info);
+ tuple_set_self_info (info);
return (GVariantTypeInfo *) info;
}
@@ -282,19 +282,19 @@ g_variant_type_info_n_members (GVariantTypeInfo *info)
{
g_assert_cmpint (info->ref_count, >, 0);
- return STRUCT_INFO (info)->n_members;
+ return TUPLE_INFO (info)->n_members;
}
const GVariantMemberInfo *
g_variant_type_info_member_info (GVariantTypeInfo *info,
gsize index)
{
- StructInfo *struct_info = STRUCT_INFO (info);
+ TupleInfo *tuple_info = TUPLE_INFO (info);
g_assert_cmpint (info->ref_count, >, 0);
- if (index < struct_info->n_members)
- return &struct_info->members[index];
+ if (index < tuple_info->n_members)
+ return &tuple_info->members[index];
return NULL;
}
@@ -390,9 +390,9 @@ g_variant_type_info_get (const GVariantType *type)
info = array_info_new (type);
break;
- case G_VARIANT_TYPE_CLASS_STRUCT:
+ case G_VARIANT_TYPE_CLASS_TUPLE:
case G_VARIANT_TYPE_CLASS_DICT_ENTRY:
- info = struct_info_new (type);
+ info = tuple_info_new (type);
break;
default:
@@ -441,8 +441,8 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
array_info_free (info);
break;
- case STRUCT_INFO_CLASS:
- struct_info_free (info);
+ case TUPLE_INFO_CLASS:
+ tuple_info_free (info);
break;
case BASE_INFO_CLASS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]