shared: add nm_hash_update_valp() helper macro

Add a macro for hashing that takes a pointer and the size is
automatically determined by sizeof(*p).
This commit is contained in:
Thomas Haller
2019-02-19 17:38:43 +01:00
parent 014d6a2c78
commit 0fdfe89f45

View File

@@ -122,6 +122,9 @@ nm_hash_update (NMHashState *state, const void *ptr, gsize n)
nm_hash_update ((state), &_val, sizeof (_val)); \
} G_STMT_END
#define nm_hash_update_valp(state, val) \
nm_hash_update ((state), (val), sizeof (*(val))) \
static inline void
nm_hash_update_bool (NMHashState *state, bool val)
{