shared: add nm_hash_obfuscated_ptr_str() helper

This commit is contained in:
Thomas Haller 2020-07-21 09:27:56 +02:00
parent 1e870c675d
commit ace515e697
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -352,6 +352,19 @@ 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))
static inline const char *
nm_hash_obfuscated_ptr_str (gconstpointer ptr, char buf[static 17])
{
int l;
nm_assert (buf);
l = g_snprintf (buf, 17, NM_HASH_OBFUSCATE_PTR_FMT, NM_HASH_OBFUSCATE_PTR (ptr));
nm_assert (l < 17);
return buf;
}
#define nm_hash_obfuscated_ptr_str_a(ptr) (nm_hash_obfuscated_ptr_str ((ptr), g_alloca (17)))
/*****************************************************************************/
#endif /* __NM_HASH_UTILS_H__ */