diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2021-01-20 17:46:03 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2021-01-20 18:06:15 -0500 |
commit | 91921618c2e06bd0ed073b8efccd31a127c9012d (patch) | |
tree | d3958b32d8db82540cd31083766b22991eb8e8ae /src/emu/debug | |
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/debug')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 3 | ||||
-rw-r--r-- | src/emu/debug/debugcon.cpp | 3 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 4 | ||||
-rw-r--r-- | src/emu/debug/debughlp.cpp | 1 | ||||
-rw-r--r-- | src/emu/debug/express.cpp | 6 |
5 files changed, 10 insertions, 7 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 7e820bafa84..65a0218eddb 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -21,6 +21,7 @@ #include "points.h" #include "natkeyboard.h" #include "render.h" +#include "corestr.h" #include <cctype> #include <algorithm> #include <fstream> @@ -3670,7 +3671,7 @@ void debugger_commands::execute_snap(int ref, const std::vector<std::string> &pa if (fname.find(".png") == -1) fname.append(".png"); emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - osd_file::error filerr = file.open(fname); + osd_file::error filerr = file.open(std::move(fname)); if (filerr != osd_file::error::NONE) { diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index 6aebd1843da..b282b000283 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -14,6 +14,7 @@ #include "debugvw.h" #include "textbuf.h" #include "debugger.h" +#include "corestr.h" #include <cctype> #include <fstream> @@ -517,7 +518,7 @@ void debugger_console::process_source_file() buf.resize(pos); // strip whitespace - strtrimrightspace(buf); + buf = strtrimrightspace(buf); // execute the command if (!buf.empty()) diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index e91a7801b3c..3a06e1f8e42 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -22,6 +22,7 @@ #include "screen.h" #include "uiinput.h" +#include "corestr.h" #include "coreutil.h" #include "osdepend.h" #include "xmlfile.h" @@ -503,14 +504,13 @@ device_debug::device_debug(device_t &device) } // add all registers into it - std::string tempstr; for (const auto &entry : m_state->state_entries()) { // TODO: floating point registers if (!entry->is_float()) { using namespace std::placeholders; - strmakelower(tempstr.assign(entry->symbol())); + std::string tempstr(strmakelower(entry->symbol())); m_symtable->add( tempstr.c_str(), std::bind(&device_state_entry::value, entry.get()), diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index cfb923cc694..e3106c647e5 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -10,6 +10,7 @@ #include "emu.h" #include "debughlp.h" +#include "corestr.h" #include <cctype> diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index b0d72d045ec..351c340333a 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -31,6 +31,8 @@ #include "emu.h" #include "express.h" + +#include "corestr.h" #include <cctype> @@ -543,9 +545,7 @@ void symbol_table::write_memory(address_space &space, offs_t address, u64 data, device_t *symbol_table::expression_get_device(const char *tag) { // convert to lowercase then lookup the name (tags are enforced to be all lower case) - std::string fullname(tag); - strmakelower(fullname); - return m_machine.root_device().subdevice(fullname.c_str()); + return m_machine.root_device().subdevice(strmakelower(tag)); } |