bluetooth: ensure function-like behavior of _LOG_bzobj() macro

We want that macros behave like functions, in that they evaluate all
their arguments exactly once.
This commit is contained in:
Thomas Haller 2021-05-25 12:44:44 +02:00
parent 95085acec3
commit ff9f2d27ec
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -575,11 +575,12 @@ _bzobj_to_string(const BzDBusObj *bzobj, char *buf, gsize len)
#define _LOG_bzobj(bzobj, context) \
G_STMT_START \
{ \
const BzDBusObj *const _bzobj = (bzobj); \
const BzDBusObj *const _bzobj = (bzobj); \
const char *const _context = (context); \
char _buf[500]; \
\
_LOGT("change %-21s %s : { %s }", \
(context), \
_context, \
_bzobj->object_path, \
_bzobj_to_string(_bzobj, _buf, sizeof(_buf))); \
} \