diff options
author | npwoods <npwoods@mess.org> | 2022-10-16 13:59:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-16 19:59:28 +0200 |
commit | 7ce32ff9440f9fc7a2204047da495a5c27bf186c (patch) | |
tree | 3b7aa626a914225f2e6ee9156cf3d2899514703c /src/frontend/mame | |
parent | 2aca0b248447b2c76d798773f99b3ec76781d8d8 (diff) |
Modernize core_strwildcmp() and core_iswildstr() (#10344)
* Modernize core_strwildcmp() and core_iswildstr()
- Changed parameters from 'const char *' to 'std::string_view'
- Removed 16-character limit in core_strwildcmp()
Diffstat (limited to 'src/frontend/mame')
-rw-r--r-- | src/frontend/mame/clifront.cpp | 14 | ||||
-rw-r--r-- | src/frontend/mame/infoxml.cpp | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 6faa41dec41..dfe0436e079 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -300,7 +300,7 @@ int cli_frontend::execute(std::vector<std::string> &args) // reason for failure, offer some suggestions if (m_result == EMU_ERR_NO_SUCH_SYSTEM && !m_options.attempted_system_name().empty() - && !core_iswildstr(m_options.attempted_system_name().c_str()) + && !core_iswildstr(m_options.attempted_system_name()) && mame_options::system(m_options) == nullptr) { // get the top 16 approximate matches @@ -911,7 +911,7 @@ void cli_frontend::listmedia(const std::vector<std::string> &args) //------------------------------------------------- void cli_frontend::verifyroms(const std::vector<std::string> &args) { - bool const iswild((1U != args.size()) || core_iswildstr(args[0].c_str())); + bool const iswild((1U != args.size()) || core_iswildstr(args[0])); std::vector<bool> matched(args.size(), false); unsigned matchcount = 0; auto const included = [&args, &matched, &matchcount] (char const *name) -> bool @@ -926,7 +926,7 @@ void cli_frontend::verifyroms(const std::vector<std::string> &args) auto it = matched.begin(); for (std::string const &pat : args) { - if (!core_strwildcmp(pat.c_str(), name)) + if (!core_strwildcmp(pat, name)) { ++matchcount; result = true; @@ -1395,7 +1395,7 @@ void cli_frontend::getsoftlist(const std::vector<std::string> &args) { for (software_list_device &swlistdev : software_list_device_enumerator(root)) { - if (core_strwildcmp(gamename, swlistdev.list_name().c_str()) == 0 && list_map.insert(swlistdev.list_name()).second) + if (core_strwildcmp(gamename, swlistdev.list_name()) == 0 && list_map.insert(swlistdev.list_name()).second) { if (!swlistdev.get_info().empty()) { @@ -1440,7 +1440,7 @@ void cli_frontend::verifysoftlist(const std::vector<std::string> &args) { for (software_list_device &swlistdev : software_list_device_enumerator(drivlist.config()->root_device())) { - if (core_strwildcmp(gamename, swlistdev.list_name().c_str()) == 0 && list_map.insert(swlistdev.list_name()).second) + if (core_strwildcmp(gamename, swlistdev.list_name()) == 0 && list_map.insert(swlistdev.list_name()).second) { if (!swlistdev.get_info().empty()) { @@ -1536,7 +1536,7 @@ void cli_frontend::romident(const std::vector<std::string> &args) template <typename T, typename U> void cli_frontend::apply_action(const std::vector<std::string> &args, T &&drvact, U &&devact) { - bool const iswild((1U != args.size()) || core_iswildstr(args[0].c_str())); + bool const iswild((1U != args.size()) || core_iswildstr(args[0])); std::vector<bool> matched(args.size(), false); auto const included = [&args, &matched] (char const *name) -> bool { @@ -1547,7 +1547,7 @@ template <typename T, typename U> void cli_frontend::apply_action(const std::vec auto it = matched.begin(); for (std::string const &pat : args) { - if (!core_strwildcmp(pat.c_str(), name)) + if (!core_strwildcmp(pat, name)) { result = true; *it = true; diff --git a/src/frontend/mame/infoxml.cpp b/src/frontend/mame/infoxml.cpp index 8ca6dfcc875..4b5d3902c98 100644 --- a/src/frontend/mame/infoxml.cpp +++ b/src/frontend/mame/infoxml.cpp @@ -388,7 +388,7 @@ void info_xml_creator::output(std::ostream &out, const std::vector<std::string> auto it = matched.begin(); for (const std::string &pat : patterns) { - if (!core_strwildcmp(pat.c_str(), shortname)) + if (!core_strwildcmp(pat, shortname)) { // this driver matches the pattern - tell the caller result = true; @@ -397,7 +397,7 @@ void info_xml_creator::output(std::ostream &out, const std::vector<std::string> if (!*it) { *it = true; - if (!core_iswildstr(pat.c_str())) + if (!core_iswildstr(pat)) { exact_matches++; |