mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gvariant: Factor out type check
This will help static analysers, similarly to with the previous commit. This introduces no functional changes. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
e36f2bb243
commit
e0fe616dbc
@ -800,12 +800,13 @@ g_variant_new_array (const GVariantType *child_type,
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
{
|
||||
if G_UNLIKELY (!g_variant_is_of_type (children[i], child_type))
|
||||
gboolean is_of_child_type = g_variant_is_of_type (children[i], child_type);
|
||||
if G_UNLIKELY (!is_of_child_type)
|
||||
{
|
||||
while (i != 0)
|
||||
g_variant_unref (my_children[--i]);
|
||||
g_free (my_children);
|
||||
g_return_val_if_fail (g_variant_is_of_type (children[i], child_type), NULL);
|
||||
g_return_val_if_fail (is_of_child_type, NULL);
|
||||
}
|
||||
my_children[i] = g_variant_ref_sink (children[i]);
|
||||
trusted &= g_variant_is_trusted (children[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user