Code Quality: Replace for loops with LISTBASE_FOREACH

Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.

Differential Revision: https://developer.blender.org/D7320
This commit is contained in:
2020-04-03 19:15:01 +02:00
parent b0c1184875
commit d138cbfb47
207 changed files with 1174 additions and 1251 deletions

View File

@@ -438,7 +438,7 @@ static bool rna_property_override_operation_store(Main *bmain,
return changed;
}
for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) {
/* Only needed for diff operations. */
if (!ELEM(opop->operation,
IDOVERRIDE_LIBRARY_OP_ADD,
@@ -832,7 +832,7 @@ bool RNA_struct_override_store(Main *bmain,
#ifdef DEBUG_OVERRIDE_TIMEIT
TIMEIT_START_AVERAGED(RNA_struct_override_store);
#endif
for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) {
LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) {
/* Simplified for now! */
PointerRNA data_reference, data_local;
PropertyRNA *prop_reference, *prop_local;
@@ -880,7 +880,7 @@ static void rna_property_override_apply_ex(Main *bmain,
IDOverrideLibraryProperty *op,
const bool do_insert)
{
for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) {
if (!do_insert != !ELEM(opop->operation,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) {
@@ -999,7 +999,7 @@ void RNA_struct_override_apply(Main *bmain,
*/
bool do_insert = false;
for (int i = 0; i < 2; i++, do_insert = true) {
for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) {
LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) {
/* Simplified for now! */
PointerRNA data_src, data_dst;
PointerRNA data_item_src, data_item_dst;