shared: add nm_gbytes_hash() and nm_gbytes_equal()

(cherry picked from commit 2a26562ec8)
This commit is contained in:
Thomas Haller 2020-04-27 08:02:11 +02:00
parent e62dcb3c6b
commit 616c18a612
2 changed files with 14 additions and 0 deletions

View file

@ -264,6 +264,17 @@ nm_ppdirect_equal (gconstpointer a, gconstpointer b)
/*****************************************************************************/
guint
nm_gbytes_hash (gconstpointer p)
{
GBytes *ptr = (GBytes *) p;
gconstpointer arr;
gsize len;
arr = g_bytes_get_data (ptr, &len);
return nm_hash_mem (792701303u, arr, len);
}
guint
nm_pgbytes_hash (gconstpointer p)
{

View file

@ -315,6 +315,9 @@ gboolean nm_ppdirect_equal (gconstpointer a, gconstpointer b);
/*****************************************************************************/
guint nm_gbytes_hash (gconstpointer p);
#define nm_gbytes_equal g_bytes_equal
guint nm_pgbytes_hash (gconstpointer p);
gboolean nm_pgbytes_equal (gconstpointer a, gconstpointer b);