diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-07 19:06:55 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-11-07 19:08:34 +0300 |
commit | 1b18e158025a488e1ba2446ad93c2eb563c11611 (patch) | |
tree | 9fa432d1bd7e622cb0d7cd4a9160bdff7d30c554 /source/blender/blenlib | |
parent | fc789803cabc9dfd47319a7f0297456c8f60153c (diff) |
Sanitize use of BLI_iterator
We now initialize iter.valid as true as part of the main iterator (and manually
when using via Python). And we don't even bother setting iter->current to NULL
if it's invalid. Let's stick to using iter->valid only.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_iterator.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h index d8929b6e73a..49a3cea58bc 100644 --- a/source/blender/blenlib/BLI_iterator.h +++ b/source/blender/blenlib/BLI_iterator.h @@ -43,12 +43,11 @@ typedef void (*IteratorBeginCb)(BLI_Iterator *iter, void *data_in); IteratorCb callback_end_func = callback_end; \ BLI_Iterator iter_macro; \ iter_macro.skip = false; \ - iter_macro.valid = false; \ + iter_macro.valid = true; \ for (callback_begin(&iter_macro, (_data_in)); \ iter_macro.valid; \ callback_next(&iter_macro)) \ { \ - BLI_assert(iter_macro.valid); \ if (iter_macro.skip) { \ iter_macro.skip = false; \ continue; \ |