summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-19 17:38:43 +0100
committerThomas Haller <thaller@redhat.com>2019-02-22 09:58:09 +0100
commit0fdfe89f45c7caf8b0f8c56afec6bbcc76c881f2 (patch)
treee3af865f439a0ee8fc34d09f298c359c74b8452c
parent014d6a2c78208475e5faacdab892d83c19f925ec (diff)
downloadNetworkManager-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).
-rw-r--r--shared/nm-utils/nm-hash-utils.h3
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)
{