From 77af18c67bb2c492ec851bf9acfd6063306cd1f5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 10:35:27 +0200 Subject: [PATCH] platform/netlink: cleanup NLA_PUT() macro Add parentheses around macro arguments. Yes, it's not technically necessary when using macro arguments are surrounded by commas. Still do it, for consistency and for not having special exceptions to the rule. --- src/libnm-platform/nm-netlink.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libnm-platform/nm-netlink.h b/src/libnm-platform/nm-netlink.h index ec4fd4f3b8..07557b99c9 100644 --- a/src/libnm-platform/nm-netlink.h +++ b/src/libnm-platform/nm-netlink.h @@ -292,21 +292,21 @@ nla_put_uint32(struct nl_msg *msg, int attrtype, uint32_t val) return nla_put(msg, attrtype, sizeof(val), &val); } -#define NLA_PUT(msg, attrtype, attrlen, data) \ - G_STMT_START \ - { \ - if (nla_put(msg, attrtype, attrlen, data) < 0) \ - goto nla_put_failure; \ - } \ +#define NLA_PUT(msg, attrtype, attrlen, data) \ + G_STMT_START \ + { \ + if (nla_put((msg), (attrtype), (attrlen), (data)) < 0) \ + goto nla_put_failure; \ + } \ G_STMT_END -#define NLA_PUT_TYPE(msg, type, attrtype, value) \ - G_STMT_START \ - { \ - type __nla_tmp = value; \ - \ - NLA_PUT(msg, attrtype, sizeof(type), &__nla_tmp); \ - } \ +#define NLA_PUT_TYPE(msg, type, attrtype, value) \ + G_STMT_START \ + { \ + type const _nla_tmp = value; \ + \ + NLA_PUT((msg), (attrtype), sizeof(_nla_tmp), &_nla_tmp); \ + } \ G_STMT_END #define NLA_PUT_U8(msg, attrtype, value) NLA_PUT_TYPE(msg, uint8_t, attrtype, value)