diff options
author | 2021-01-20 17:46:03 -0500 | |
---|---|---|
committer | 2021-01-20 18:06:15 -0500 | |
commit | 91921618c2e06bd0ed073b8efccd31a127c9012d (patch) | |
tree | d3958b32d8db82540cd31083766b22991eb8e8ae /src/emu/validity.cpp | |
parent | c691b79cce315acdfabe1901cb2b5a1e39957bc1 (diff) |
Much more core std::string_view modernization
- Remove corestr.h from emu.h; update a few source files to not use it at all
- Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type
- Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string
- Remove the string-modifying version of zippath_parent
- Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char *
- Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only
- Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this)
- Change output_manager to use std::string_view for output name arguments
- Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now)
- Change miscellaneous other functions to accept std::string_view arguments
- Remove a few string accessor macros from romload.h
- Remove many unnecessary c_str() calls from logging/error messages
Diffstat (limited to 'src/emu/validity.cpp')
-rw-r--r-- | src/emu/validity.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 09758807e8e..710473b85f9 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "validity.h" +#include "corestr.h" #include "emuopts.h" #include "romload.h" #include "video/rgbutil.h" @@ -291,7 +292,7 @@ void validity_checker::validate_one(const game_driver &driver) { // help verbose validation detect configuration-related crashes if (m_print_verbose) - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Validating driver %s (%s)...\n", driver.name, core_filename_extract_base(driver.type.source()).c_str()); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Validating driver %s (%s)...\n", driver.name, core_filename_extract_base(driver.type.source())); // set the current driver m_current_driver = &driver; @@ -326,7 +327,7 @@ void validity_checker::validate_one(const game_driver &driver) if (m_errors > start_errors || m_warnings > start_warnings || !m_verbose_text.empty()) { if (!m_print_verbose) - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): ", driver.name, core_filename_extract_base(driver.type.source()).c_str()); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): ", driver.name, core_filename_extract_base(driver.type.source())); output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "%d errors, %d warnings\n", m_errors - start_errors, m_warnings - start_warnings); if (m_errors > start_errors) output_indented_errors(m_error_text, "Errors"); @@ -2121,10 +2122,10 @@ void validity_checker::validate_device_types() device_t *const dev = config.device_add(type.shortname(), type, 0); char const *name((dev->shortname() && *dev->shortname()) ? dev->shortname() : type.type().name()); - std::string const description((dev->source() && *dev->source()) ? util::string_format("%s(%s)", core_filename_extract_base(dev->source()).c_str(), name) : name); + std::string const description((dev->source() && *dev->source()) ? util::string_format("%s(%s)", core_filename_extract_base(dev->source()), name) : name); if (m_print_verbose) - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Validating device %s...\n", description.c_str()); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Validating device %s...\n", description); // ensure shortname exists if (!dev->shortname() || !*dev->shortname()) @@ -2327,5 +2328,5 @@ void validity_checker::output_indented_errors(std::string &text, const char *hea if (text[text.size()-1] == '\n') text.erase(text.size()-1, 1); strreplace(text, "\n", "\n "); - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "%s:\n %s\n", header, text.c_str()); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "%s:\n %s\n", header, text); } |