mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
Merge branch 'wip/smcv/memcmp-null' into 'master'
gvariant, gbytes: Avoid memcmp (NULL, ., 0) or memcmp (., NULL, 0) See merge request GNOME/glib!1214
This commit is contained in:
commit
3b980ab9eb
@ -365,7 +365,7 @@ g_bytes_equal (gconstpointer bytes1,
|
|||||||
g_return_val_if_fail (bytes2 != NULL, FALSE);
|
g_return_val_if_fail (bytes2 != NULL, FALSE);
|
||||||
|
|
||||||
return b1->size == b2->size &&
|
return b1->size == b2->size &&
|
||||||
memcmp (b1->data, b2->data, b1->size) == 0;
|
(b1->size == 0 || memcmp (b1->data, b2->data, b1->size) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2765,7 +2765,10 @@ g_variant_equal (gconstpointer one,
|
|||||||
data_one = g_variant_get_data ((GVariant *) one);
|
data_one = g_variant_get_data ((GVariant *) one);
|
||||||
data_two = g_variant_get_data ((GVariant *) two);
|
data_two = g_variant_get_data ((GVariant *) two);
|
||||||
|
|
||||||
equal = memcmp (data_one, data_two, size_one) == 0;
|
if (size_one)
|
||||||
|
equal = memcmp (data_one, data_two, size_one) == 0;
|
||||||
|
else
|
||||||
|
equal = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user