From cc49c479a746314d9620d84e5513f08b2faeea71 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 5 Nov 2021 16:35:52 +0100 Subject: 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). --- source/blender/editors/asset/ED_asset_list.hh | 2 +- source/blender/editors/asset/intern/asset_list.cc | 4 ++-- source/blender/editors/interface/interface_template_asset_view.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/asset/ED_asset_list.hh b/source/blender/editors/asset/ED_asset_list.hh index dcc07f54e75..24def2fb4ab 100644 --- a/source/blender/editors/asset/ED_asset_list.hh +++ b/source/blender/editors/asset/ED_asset_list.hh @@ -35,4 +35,4 @@ std::string ED_assetlist_asset_filepath_get(const bContext *C, /* Can return false to stop iterating. */ using AssetListIterFn = blender::FunctionRef; -void ED_assetlist_iterate(const AssetLibraryReference *library_reference, AssetListIterFn fn); +void ED_assetlist_iterate(const AssetLibraryReference &library_reference, AssetListIterFn fn); diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc index b5ea054fb5d..c1b1e33d428 100644 --- a/source/blender/editors/asset/intern/asset_list.cc +++ b/source/blender/editors/asset/intern/asset_list.cc @@ -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); } diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index d3ce7ebc3db..7b2fb8f784e 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -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; -- cgit v1.2.3