diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-19 09:01:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-19 09:28:17 +0300 |
commit | 14b2a35c8bfd6d77f6357f929ddd82845436725f (patch) | |
tree | 54746d6a3cf0da24b95d2a9761e6222656eb5249 /source/blender/blenlib | |
parent | 17a2820da8ad8ea23d336129f32e060e5746b047 (diff) |
Cleanup: use parenthesis for if statements in macros
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_bitmap.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 60 | ||||
-rw-r--r-- | source/blender/blenlib/intern/task_iterator.c | 6 |
3 files changed, 48 insertions, 24 deletions
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 61a50662d79..960ce44c58c 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -93,10 +93,12 @@ typedef unsigned int BLI_bitmap; #define BLI_BITMAP_SET(_bitmap, _index, _set) \ { \ CHECK_TYPE(_bitmap, BLI_bitmap *); \ - if (_set) \ + if (_set) { \ BLI_BITMAP_ENABLE(_bitmap, _index); \ - else \ + } \ + else { \ BLI_BITMAP_DISABLE(_bitmap, _index); \ + } \ } \ (void)0 diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index acfa77ecf31..326015e8d80 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -136,50 +136,66 @@ extern "C" { (void)0 #define DO_MIN(vec, min) \ { \ - if ((min)[0] > (vec)[0]) \ + if ((min)[0] > (vec)[0]) { \ (min)[0] = (vec)[0]; \ - if ((min)[1] > (vec)[1]) \ + } \ + if ((min)[1] > (vec)[1]) { \ (min)[1] = (vec)[1]; \ - if ((min)[2] > (vec)[2]) \ + } \ + if ((min)[2] > (vec)[2]) { \ (min)[2] = (vec)[2]; \ + } \ } \ (void)0 #define DO_MAX(vec, max) \ { \ - if ((max)[0] < (vec)[0]) \ + if ((max)[0] < (vec)[0]) { \ (max)[0] = (vec)[0]; \ - if ((max)[1] < (vec)[1]) \ + } \ + if ((max)[1] < (vec)[1]) { \ (max)[1] = (vec)[1]; \ - if ((max)[2] < (vec)[2]) \ + } \ + if ((max)[2] < (vec)[2]) { \ (max)[2] = (vec)[2]; \ + } \ } \ (void)0 #define DO_MINMAX(vec, min, max) \ { \ - if ((min)[0] > (vec)[0]) \ + if ((min)[0] > (vec)[0]) { \ (min)[0] = (vec)[0]; \ - if ((min)[1] > (vec)[1]) \ + } \ + if ((min)[1] > (vec)[1]) { \ (min)[1] = (vec)[1]; \ - if ((min)[2] > (vec)[2]) \ + } \ + if ((min)[2] > (vec)[2]) { \ (min)[2] = (vec)[2]; \ - if ((max)[0] < (vec)[0]) \ + } \ + if ((max)[0] < (vec)[0]) { \ (max)[0] = (vec)[0]; \ - if ((max)[1] < (vec)[1]) \ + } \ + if ((max)[1] < (vec)[1]) { \ (max)[1] = (vec)[1]; \ - if ((max)[2] < (vec)[2]) \ + } \ + if ((max)[2] < (vec)[2]) { \ (max)[2] = (vec)[2]; \ + } \ } \ (void)0 #define DO_MINMAX2(vec, min, max) \ { \ - if ((min)[0] > (vec)[0]) \ + if ((min)[0] > (vec)[0]) { \ (min)[0] = (vec)[0]; \ - if ((min)[1] > (vec)[1]) \ + } \ + if ((min)[1] > (vec)[1]) { \ (min)[1] = (vec)[1]; \ - if ((max)[0] < (vec)[0]) \ + } \ + if ((max)[0] < (vec)[0]) { \ (max)[0] = (vec)[0]; \ - if ((max)[1] < (vec)[1]) \ + } \ + if ((max)[1] < (vec)[1]) { \ (max)[1] = (vec)[1]; \ + } \ } \ (void)0 @@ -330,24 +346,28 @@ extern "C" { #define CLAMP(a, b, c) \ { \ - if ((a) < (b)) \ + if ((a) < (b)) { \ (a) = (b); \ - else if ((a) > (c)) \ + } \ + else if ((a) > (c)) { \ (a) = (c); \ + } \ } \ (void)0 #define CLAMP_MAX(a, c) \ { \ - if ((a) > (c)) \ + if ((a) > (c)) { \ (a) = (c); \ + } \ } \ (void)0 #define CLAMP_MIN(a, b) \ { \ - if ((a) < (b)) \ + if ((a) < (b)) { \ (a) = (b); \ + } \ } \ (void)0 diff --git a/source/blender/blenlib/intern/task_iterator.c b/source/blender/blenlib/intern/task_iterator.c index ee459ac2548..38271e5823f 100644 --- a/source/blender/blenlib/intern/task_iterator.c +++ b/source/blender/blenlib/intern/task_iterator.c @@ -37,8 +37,10 @@ /* Allows to avoid using malloc for userdata_chunk in tasks, when small enough. */ #define MALLOCA(_size) ((_size) <= 8192) ? alloca((_size)) : MEM_mallocN((_size), __func__) #define MALLOCA_FREE(_mem, _size) \ - if (((_mem) != NULL) && ((_size) > 8192)) \ - MEM_freeN((_mem)) + if (((_mem) != NULL) && ((_size) > 8192)) { \ + MEM_freeN((_mem)); \ + } \ + ((void)0) BLI_INLINE void task_parallel_calc_chunk_size(const TaskParallelSettings *settings, const int tot_items, |