mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
gvariant-core: Consolidate construction of GVariantSerialised
So I only need to change it in one place. This introduces no functional changes. Helps: #2121
This commit is contained in:
parent
782b5cbee5
commit
1deacdd4e8
@ -351,6 +351,27 @@ g_variant_ensure_size (GVariant *value)
|
||||
}
|
||||
}
|
||||
|
||||
/* < private >
|
||||
* g_variant_to_serialised:
|
||||
* @value: a #GVariant
|
||||
*
|
||||
* Gets a GVariantSerialised for a GVariant in state STATE_SERIALISED.
|
||||
*/
|
||||
inline static GVariantSerialised
|
||||
g_variant_to_serialised (GVariant *value)
|
||||
{
|
||||
g_assert (value->state & STATE_SERIALISED);
|
||||
{
|
||||
GVariantSerialised serialised = {
|
||||
value->type_info,
|
||||
(gpointer) value->contents.serialised.data,
|
||||
value->size,
|
||||
value->depth,
|
||||
};
|
||||
return serialised;
|
||||
}
|
||||
}
|
||||
|
||||
/* < private >
|
||||
* g_variant_serialise:
|
||||
* @value: a #GVariant
|
||||
@ -1009,16 +1030,8 @@ g_variant_n_children (GVariant *value)
|
||||
g_variant_lock (value);
|
||||
|
||||
if (value->state & STATE_SERIALISED)
|
||||
{
|
||||
GVariantSerialised serialised = {
|
||||
value->type_info,
|
||||
(gpointer) value->contents.serialised.data,
|
||||
value->size,
|
||||
value->depth,
|
||||
};
|
||||
|
||||
n_children = g_variant_serialised_n_children (serialised);
|
||||
}
|
||||
n_children = g_variant_serialised_n_children (
|
||||
g_variant_to_serialised (value));
|
||||
else
|
||||
n_children = value->contents.tree.n_children;
|
||||
|
||||
@ -1085,12 +1098,7 @@ g_variant_get_child_value (GVariant *value,
|
||||
}
|
||||
|
||||
{
|
||||
GVariantSerialised serialised = {
|
||||
value->type_info,
|
||||
(gpointer) value->contents.serialised.data,
|
||||
value->size,
|
||||
value->depth,
|
||||
};
|
||||
GVariantSerialised serialised = g_variant_to_serialised (value);
|
||||
GVariantSerialised s_child;
|
||||
GVariant *child;
|
||||
|
||||
@ -1203,14 +1211,7 @@ g_variant_is_normal_form (GVariant *value)
|
||||
|
||||
if (value->state & STATE_SERIALISED)
|
||||
{
|
||||
GVariantSerialised serialised = {
|
||||
value->type_info,
|
||||
(gpointer) value->contents.serialised.data,
|
||||
value->size,
|
||||
value->depth
|
||||
};
|
||||
|
||||
if (g_variant_serialised_is_normal (serialised))
|
||||
if (g_variant_serialised_is_normal (g_variant_to_serialised (value)))
|
||||
value->state |= STATE_TRUSTED;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user