From 1ff3d5bc9ab7b296b1c60038d45ef4c030403162 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 14 Feb 2017 15:46:01 +0100 Subject: 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. --- source/blender/blenlib/BLI_iterator.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/blenlib/BLI_iterator.h') 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 \ } \ -- cgit v1.2.3