diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 17:46:01 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 20:21:46 +0300 |
commit | 1ff3d5bc9ab7b296b1c60038d45ef4c030403162 (patch) | |
tree | ccda1f1d1913aab4268a03699944a11f578b5c4b /source/blender/blenlib/BLI_iterator.h | |
parent | b9762fed932b7f508aec5650fd80679cf635d677 (diff) |
Layer Macros: create the instance as part of the macro
Instead of pre-initializing an instance prior to the macro, we do it as part of the macro itself now.
Diffstat (limited to 'source/blender/blenlib/BLI_iterator.h')
-rw-r--r-- | source/blender/blenlib/BLI_iterator.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h index d154b81ac82..26d2728d432 100644 --- a/source/blender/blenlib/BLI_iterator.h +++ b/source/blender/blenlib/BLI_iterator.h @@ -36,15 +36,16 @@ typedef struct Iterator { typedef void (*IteratorCb)(Iterator *iter); typedef void (*IteratorBeginCb)(Iterator *iter, void *data_in); -#define ITER_BEGIN(callback_begin, callback_next, callback_end, _data_in, _type, _data_out) \ +#define ITER_BEGIN(callback_begin, callback_next, callback_end, _data_in, _type, _instance) \ { \ + _type _instance; \ IteratorCb callback_end_func = callback_end; \ Iterator iter_macro; \ - for (callback_begin(&iter_macro, _data_in); \ + for (callback_begin(&iter_macro, (_data_in)); \ iter_macro.valid; \ callback_next(&iter_macro)) \ { \ - _data_out = (_type *) iter_macro.current; + _instance = (_type ) iter_macro.current; #define ITER_END \ } \ |