mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
gvariant: Port g_variant_deep_copy() to count its iterations directly
This is equivalent to what `GVariantIter` does, but it means that `g_variant_deep_copy()` is making its own `g_variant_get_child_value()` calls. This will be useful in an upcoming commit, where those child values will be inspected a little more deeply. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #2121
This commit is contained in:
parent
35dee77ed8
commit
e6490c84e8
@ -5863,14 +5863,13 @@ g_variant_deep_copy (GVariant *value)
|
||||
case G_VARIANT_CLASS_VARIANT:
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
GVariantIter iter;
|
||||
GVariant *child;
|
||||
gsize i, n_children;
|
||||
|
||||
g_variant_builder_init (&builder, g_variant_get_type (value));
|
||||
g_variant_iter_init (&iter, value);
|
||||
|
||||
while ((child = g_variant_iter_next_value (&iter)))
|
||||
for (i = 0, n_children = g_variant_n_children (value); i < n_children; i++)
|
||||
{
|
||||
GVariant *child = g_variant_get_child_value (value, i);
|
||||
g_variant_builder_add_value (&builder, g_variant_deep_copy (child));
|
||||
g_variant_unref (child);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user