From ff9f2d27ecc7328428cfa8f24a35a3c03e9cb5bc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 25 May 2021 12:44:44 +0200 Subject: [PATCH] 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. --- src/core/devices/bluetooth/nm-bluez-manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/devices/bluetooth/nm-bluez-manager.c b/src/core/devices/bluetooth/nm-bluez-manager.c index 953c1fd070..ae59bc7854 100644 --- a/src/core/devices/bluetooth/nm-bluez-manager.c +++ b/src/core/devices/bluetooth/nm-bluez-manager.c @@ -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))); \ } \