Cleanup: Use `switch` and `BLI_assert_unreachable()` more.

Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
This commit is contained in:
Bastien Montagne 2022-05-17 15:11:30 +02:00
parent c6e3242e18
commit 22bf263269
3 changed files with 3 additions and 3 deletions

View File

@ -2413,7 +2413,7 @@ static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
if (collection->flag & COLLECTION_IS_MASTER) {
/* We should never reach that point anymore, since master collection private ID should be
* properly tagged with IDWALK_CB_EMBEDDED. */
BLI_assert(0);
BLI_assert_unreachable();
return IDWALK_RET_NOP;
}
}

View File

@ -120,7 +120,7 @@ void BLO_memfile_write_init(MemFileWriteData *mem_data,
*entry = mem_chunk;
}
else {
BLI_assert(0);
BLI_assert_unreachable();
}
}
}

View File

@ -1409,7 +1409,7 @@ bool BLO_write_file(Main *mainvar,
BKE_bpath_absolute_convert(mainvar, dir_src, NULL);
break;
case BLO_WRITE_PATH_REMAP_NONE:
BLI_assert(0); /* Unreachable. */
BLI_assert_unreachable(); /* Unreachable. */
break;
}
}