mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 22:46:15 +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 >
|
/* < private >
|
||||||
* g_variant_serialise:
|
* g_variant_serialise:
|
||||||
* @value: a #GVariant
|
* @value: a #GVariant
|
||||||
@ -1009,16 +1030,8 @@ g_variant_n_children (GVariant *value)
|
|||||||
g_variant_lock (value);
|
g_variant_lock (value);
|
||||||
|
|
||||||
if (value->state & STATE_SERIALISED)
|
if (value->state & STATE_SERIALISED)
|
||||||
{
|
n_children = g_variant_serialised_n_children (
|
||||||
GVariantSerialised serialised = {
|
g_variant_to_serialised (value));
|
||||||
value->type_info,
|
|
||||||
(gpointer) value->contents.serialised.data,
|
|
||||||
value->size,
|
|
||||||
value->depth,
|
|
||||||
};
|
|
||||||
|
|
||||||
n_children = g_variant_serialised_n_children (serialised);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
n_children = value->contents.tree.n_children;
|
n_children = value->contents.tree.n_children;
|
||||||
|
|
||||||
@ -1085,12 +1098,7 @@ g_variant_get_child_value (GVariant *value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GVariantSerialised serialised = {
|
GVariantSerialised serialised = g_variant_to_serialised (value);
|
||||||
value->type_info,
|
|
||||||
(gpointer) value->contents.serialised.data,
|
|
||||||
value->size,
|
|
||||||
value->depth,
|
|
||||||
};
|
|
||||||
GVariantSerialised s_child;
|
GVariantSerialised s_child;
|
||||||
GVariant *child;
|
GVariant *child;
|
||||||
|
|
||||||
@ -1203,14 +1211,7 @@ g_variant_is_normal_form (GVariant *value)
|
|||||||
|
|
||||||
if (value->state & STATE_SERIALISED)
|
if (value->state & STATE_SERIALISED)
|
||||||
{
|
{
|
||||||
GVariantSerialised serialised = {
|
if (g_variant_serialised_is_normal (g_variant_to_serialised (value)))
|
||||||
value->type_info,
|
|
||||||
(gpointer) value->contents.serialised.data,
|
|
||||||
value->size,
|
|
||||||
value->depth
|
|
||||||
};
|
|
||||||
|
|
||||||
if (g_variant_serialised_is_normal (serialised))
|
|
||||||
value->state |= STATE_TRUSTED;
|
value->state |= STATE_TRUSTED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user