mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 15:10:22 +01:00
dns: avoid printing pointer value for NMDnsManager logging statements
We avoid printing raw pointer values. Also, in this case this is a singleton, and we only create one instance of this type. Note that we would still have printed the pointer instance while constructing the instances, before setting it as singleton. Just drop this.
This commit is contained in:
parent
bd95a5c0ec
commit
f7b41fc18c
1 changed files with 17 additions and 22 deletions
|
|
@ -137,28 +137,23 @@ NM_DEFINE_SINGLETON_GETTER(NMDnsManager, nm_dns_manager_get, NM_TYPE_DNS_MANAGER
|
|||
|
||||
#define _NMLOG_PREFIX_NAME "dns-mgr"
|
||||
#define _NMLOG_DOMAIN LOGD_DNS
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
const NMLogLevel __level = (level); \
|
||||
\
|
||||
if (nm_logging_enabled(__level, _NMLOG_DOMAIN)) { \
|
||||
char __prefix[20]; \
|
||||
const NMDnsManager *const __self = (self); \
|
||||
\
|
||||
_nm_log(__level, \
|
||||
_NMLOG_DOMAIN, \
|
||||
0, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
"%s%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
_NMLOG_PREFIX_NAME, \
|
||||
((!__self || __self == singleton_instance) \
|
||||
? "" \
|
||||
: nm_sprintf_buf(__prefix, "[%p]", __self)) \
|
||||
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} \
|
||||
} \
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
const NMLogLevel __level = (level); \
|
||||
\
|
||||
if (nm_logging_enabled(__level, _NMLOG_DOMAIN)) { \
|
||||
_nm_unused const NMDnsManager *const __self = (self); \
|
||||
\
|
||||
_nm_log(__level, \
|
||||
_NMLOG_DOMAIN, \
|
||||
0, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
_NMLOG_PREFIX_NAME _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue