libnm-core: use g_variant_type_equal() to compare variant types

Even if a direct pointer comparison should be fine, use the proper
function. GVariantType documentation says:

 "Two types may not be compared by value; use g_variant_type_equal()
 or g_variant_type_is_subtype_of()."

This also fixes coverity warnings.
This commit is contained in:
Beniamino Galvani 2018-10-04 09:36:11 +02:00
parent 9b04b871a0
commit 27ab932a49
2 changed files with 2 additions and 2 deletions

View file

@ -1310,7 +1310,7 @@ nm_ip_route_attribute_validate (const char *name,
return FALSE;
}
if (spec->type == G_VARIANT_TYPE_STRING) {
if (g_variant_type_equal (spec->type, G_VARIANT_TYPE_STRING)) {
const char *string = g_variant_get_string (value, NULL);
gs_free char *string_free = NULL;
char *sep;

View file

@ -433,7 +433,7 @@ nm_sriov_vf_attribute_validate (const char *name,
return FALSE;
}
if (spec->type == G_VARIANT_TYPE_STRING) {
if (g_variant_type_equal (spec->type, G_VARIANT_TYPE_STRING)) {
const char *string;
switch (spec->str_type) {