Cleanup: Use reference for non-optional C++ parameter

A reference makes clear that NULL is not an expected value. So it's the
prefered way of passing a `const` input parameter (at least if it may
not be cheap to copy).
This commit is contained in:
Julian Eisel 2021-11-05 16:35:52 +01:00
parent aaf86bad87
commit cc49c479a7
3 changed files with 4 additions and 4 deletions

View File

@ -35,4 +35,4 @@ std::string ED_assetlist_asset_filepath_get(const bContext *C,
/* Can return false to stop iterating. */
using AssetListIterFn = blender::FunctionRef<bool(AssetHandle)>;
void ED_assetlist_iterate(const AssetLibraryReference *library_reference, AssetListIterFn fn);
void ED_assetlist_iterate(const AssetLibraryReference &library_reference, AssetListIterFn fn);

View File

@ -456,9 +456,9 @@ bool ED_assetlist_storage_has_list_for_library(const AssetLibraryReference *libr
return AssetListStorage::lookup_list(*library_reference) != nullptr;
}
void ED_assetlist_iterate(const AssetLibraryReference *library_reference, AssetListIterFn fn)
void ED_assetlist_iterate(const AssetLibraryReference &library_reference, AssetListIterFn fn)
{
AssetList *list = AssetListStorage::lookup_list(*library_reference);
AssetList *list = AssetListStorage::lookup_list(library_reference);
if (list) {
list->iterate(fn);
}

View File

@ -178,7 +178,7 @@ static void asset_view_template_refresh_asset_collection(
RNA_property_collection_clear(&assets_dataptr, assets_prop);
ED_assetlist_iterate(&asset_library_ref, [&](AssetHandle asset) {
ED_assetlist_iterate(asset_library_ref, [&](AssetHandle asset) {
if (!ED_asset_filter_matches_asset(&filter_settings, &asset)) {
/* Don't do anything else, but return true to continue iterating. */
return true;