mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 18:50:07 +01:00
shared: add nm_hash_mem() helper
This commit is contained in:
parent
962ad7f850
commit
b1503d8a72
1 changed files with 12 additions and 0 deletions
|
|
@ -266,6 +266,18 @@ guint nm_str_hash (gconstpointer str);
|
|||
nm_hash_complete (&_h); \
|
||||
})
|
||||
|
||||
static inline guint
|
||||
nm_hash_mem (guint static_seed, const void *ptr, gsize n)
|
||||
{
|
||||
NMHashState h;
|
||||
|
||||
if (n == 0)
|
||||
return nm_hash_static (static_seed);
|
||||
nm_hash_init (&h, static_seed);
|
||||
nm_hash_update (&h, ptr, n);
|
||||
return nm_hash_complete (&h);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* nm_pstr_*() are for hashing keys that are pointers to strings,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue