diff options
author | Thomas Haller <thaller@redhat.com> | 2018-06-28 17:12:54 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-07-11 09:53:00 +0200 |
commit | 309ce6d8b3727057b7a406eb67890135c30d5eb6 (patch) | |
tree | 7987e16b7a18ed09cac40f048ccde051583bae33 | |
parent | 354140e8d3a9f0b72ba6da3011cc6c506c607f4f (diff) | |
download | NetworkManager-309ce6d8b3727057b7a406eb67890135c30d5eb6.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, |