diff options
author | Thomas Haller <thaller@redhat.com> | 2019-02-19 17:38:43 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-02-22 09:58:09 +0100 |
commit | 0fdfe89f45c7caf8b0f8c56afec6bbcc76c881f2 (patch) | |
tree | e3af865f439a0ee8fc34d09f298c359c74b8452c /shared | |
parent | 014d6a2c78208475e5faacdab892d83c19f925ec (diff) | |
download | NetworkManager-0fdfe89f45c7caf8b0f8c56afec6bbcc76c881f2.tar.gz |
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).
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-utils/nm-hash-utils.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-hash-utils.h b/shared/nm-utils/nm-hash-utils.h index cf71a7e9f2..1a1e44f50b 100644 --- a/shared/nm-utils/nm-hash-utils.h +++ b/shared/nm-utils/nm-hash-utils.h @@ -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) { |