diff options
author | Moti Cohen <moti.cohen@redis.com> | 2022-08-03 19:38:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-03 19:38:08 +0300 |
commit | 1aa6c4ab9294af4eef50fbd82079051f4c06dd42 (patch) | |
tree | df96cdc70b889964ae8d0410b6ee9b2affb5f701 /src/atomicvar.h | |
parent | dcafee55a580430b17ca237799a4eff245919c3b (diff) | |
download | redis-1aa6c4ab9294af4eef50fbd82079051f4c06dd42.tar.gz |
Adding parentheses and do-while(0) to macros (#11080)
Fixing few macros that doesn't follows most basic safety conventions
which is wrapping any usage of passed variable
with parentheses and if written more than one command, then wrap
it with do-while(0) (or parentheses).
Diffstat (limited to 'src/atomicvar.h')
-rw-r--r-- | src/atomicvar.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/atomicvar.h b/src/atomicvar.h index 222b82699..2c2969c33 100644 --- a/src/atomicvar.h +++ b/src/atomicvar.h @@ -141,7 +141,7 @@ while(!__sync_bool_compare_and_swap(&var,var,value)); \ } while(0) /* Actually the builtin issues a full memory barrier by default. */ -#define atomicGetWithSync(var,dstvar) { \ +#define atomicGetWithSync(var,dstvar) do { \ dstvar = __sync_sub_and_fetch(&var,0,__sync_synchronize); \ ANNOTATE_HAPPENS_AFTER(&var); \ } while(0) |