diff options
author | Thomas Haller <thaller@redhat.com> | 2018-06-28 17:12:54 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-07-11 16:16:22 +0200 |
commit | fe07d6a404c05cea7d5e13fca8751ac82a7cff0f (patch) | |
tree | 995bc3a1d35ae970c5967551da2618b9dffa1a04 | |
parent | 2abf4652d43651e014d99e5fac8de9df10df9bbb (diff) | |
download | NetworkManager-fe07d6a404c05cea7d5e13fca8751ac82a7cff0f.tar.gz |
shared: add nm_hash_val() macro
A helper macro, to combine the steps for hashing one value.
-rw-r--r-- | shared/nm-utils/nm-hash-utils.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-hash-utils.h b/shared/nm-utils/nm-hash-utils.h index d0bb6cf9b8..7d9620b96c 100644 --- a/shared/nm-utils/nm-hash-utils.h +++ b/shared/nm-utils/nm-hash-utils.h @@ -209,6 +209,15 @@ guint nm_direct_hash (gconstpointer str); guint nm_hash_str (const char *str); guint nm_str_hash (gconstpointer str); +#define nm_hash_val(static_seed, val) \ + ({ \ + NMHashState _h; \ + \ + nm_hash_init (&_h, static_seed); \ + nm_hash_update_val (&_h, val); \ + nm_hash_complete (&_h); \ + }) + /*****************************************************************************/ /* nm_pstr_*() are for hashing keys that are pointers to strings, |