shared: add nm_hash_val() macro

A helper macro, to combine the steps for hashing one value.
This commit is contained in:
Thomas Haller 2018-06-28 17:12:54 +02:00 committed by Beniamino Galvani
parent 2abf4652d4
commit fe07d6a404

View file

@ -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,