From 22988d874570c35251076f9edc1cd3c99ecb6785 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 3 Jun 2020 15:50:19 -0700 Subject: Add parentheses to macro arguments [clang-tidy] Found with bugprone-macro-parentheses Signed-off-by: Rosen Penev --- common/collection.c | 2 +- tools/iproxy.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/collection.c b/common/collection.c index 92bd645..8a2fe72 100644 --- a/common/collection.c +++ b/common/collection.c @@ -31,7 +31,7 @@ #undef NDEBUG // we need to make sure we still get assertions because we can't handle memory allocation errors #include -#define INIT_NULL(addr, count) { unsigned int i_ = 0; for (i_ = 0; i_ < count; i_++) ((void**)addr)[i_] = NULL; } +#define INIT_NULL(addr, count) { unsigned int i_ = 0; for (i_ = 0; i_ < (count); i_++) ((void**)(addr))[i_] = NULL; } #define CAPACITY_STEP 8 diff --git a/tools/iproxy.c b/tools/iproxy.c index 5dca580..bd56ebd 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -68,9 +68,9 @@ struct client_data { }; #define CDATA_FREE(x) if (x) { \ - if (x->fd > 0) socket_close(x->fd); \ - if (x->sfd > 0) socket_close(x->sfd); \ - free(x->udid); \ + if ((x)->fd > 0) socket_close((x)->fd); \ + if ((x)->sfd > 0) socket_close((x)->sfd); \ + free((x)->udid); \ free(x); \ } -- cgit v1.1-32-gdbae