mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
shared: add NM_HASH_OBFUSCATE_PTR_STR() helper macro
Contrary to NM_HASH_OBFUSCATE_PTR(), this allows to special case a %NULL pointer. Also, it quotes the obfuscated value in square brackets.
This commit is contained in:
parent
621ca03b33
commit
5b941666e9
|
@ -416,6 +416,14 @@ nm_hash_obfuscate_ptr(guint static_seed, gconstpointer val)
|
|||
* values in a global context. */
|
||||
#define NM_HASH_OBFUSCATE_PTR(ptr) (nm_hash_obfuscate_ptr(1678382159u, ptr))
|
||||
|
||||
#define NM_HASH_OBFUSCATE_PTR_STR(ptr, buf) \
|
||||
({ \
|
||||
gconstpointer _ptr = (ptr); \
|
||||
\
|
||||
_ptr ? nm_sprintf_buf(buf, "[" NM_HASH_OBFUSCATE_PTR_FMT "]", NM_HASH_OBFUSCATE_PTR(_ptr)) \
|
||||
: "(null)"; \
|
||||
})
|
||||
|
||||
static inline const char *
|
||||
nm_hash_obfuscated_ptr_str(gconstpointer ptr, char buf[static 17])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue