gvariant: Simplify GVariantType check in g_variant_format_string_scan_type()

Rather than returning through `G_VARIANT_TYPE`, which scan-build doesn’t
seem to fully understand ownership transfers through, just return `new`
directly, and do the `is_valid()` check separately.

The new code is equivalent to the old code, but squashes a scan-build
false positive around leaking `dest`. (See also: the previous commit.)

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
This commit is contained in:
Philip Withnall 2024-04-12 17:46:51 +01:00
parent 156c1496ba
commit b1bafda881
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -4639,7 +4639,9 @@ g_variant_format_string_scan_type (const gchar *string,
}
new[i++] = '\0';
return (GVariantType *) G_VARIANT_TYPE (new);
g_assert (g_variant_type_string_is_valid (new));
return (GVariantType *) new;
}
static gboolean