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-21 21:00:44 +0100
commit984a47b853313cef19f574db6c2d0c9f4e06a54d (patch)
treea040623a453df4df97bcf43167e1e1de70064e6e
parent7b7b2da9d2262438c0c0e6c7c738e71405a19deb (diff)
downloadNetworkManager-984a47b853313cef19f574db6c2d0c9f4e06a54d.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)
{