mirror of
https://github.com/holub/mame
synced 2025-06-23 21:06:38 +03:00
Added a usage of std::find_if() in softlist
This commit is contained in:
parent
c912765d78
commit
87d53be505
@ -519,13 +519,20 @@ const software_info *software_list_device::find(const char *look_for)
|
|||||||
bool iswild = strchr(look_for, '*') != nullptr || strchr(look_for, '?');
|
bool iswild = strchr(look_for, '*') != nullptr || strchr(look_for, '?');
|
||||||
|
|
||||||
// find a match (will cause a parse if needed when calling get_info)
|
// find a match (will cause a parse if needed when calling get_info)
|
||||||
for (const software_info &info : get_info())
|
const auto &info_list = get_info();
|
||||||
{
|
auto iter = std::find_if(
|
||||||
if ((iswild && core_strwildcmp(look_for, info.shortname().c_str()) == 0) || core_stricmp(look_for, info.shortname().c_str()) == 0)
|
info_list.begin(),
|
||||||
return &info;
|
info_list.end(),
|
||||||
}
|
[&](const software_info &info)
|
||||||
|
{
|
||||||
|
const char *shortname = info.shortname().c_str();
|
||||||
|
return (iswild && core_strwildcmp(look_for, shortname) == 0)
|
||||||
|
|| core_stricmp(look_for, shortname) == 0;
|
||||||
|
});
|
||||||
|
|
||||||
return nullptr;
|
return iter != info_list.end()
|
||||||
|
? &*iter
|
||||||
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user