summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/uml.cpp
diff options
context:
space:
mode:
author Miodrag Milanović <mmicko@gmail.com>2016-01-11 09:18:43 +0100
committer Miodrag Milanović <mmicko@gmail.com>2016-01-11 09:18:43 +0100
commit36195292e370de0fb6b32085c105a236995ce36e (patch)
tree1fb147c3e21824272b60e4989f606bc9c206030c /src/devices/cpu/uml.cpp
parent7c944fa3b02cd26dec3c27f1e6a4c0d33f462c4e (diff)
parent115db95642ad6d861aad63775b92350e0491f2dd (diff)
Merge pull request #561 from ajrhacker/strings
Return std::string objects by value rather than pass by reference [ajrhacker]
Diffstat (limited to 'src/devices/cpu/uml.cpp')
-rw-r--r--src/devices/cpu/uml.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/devices/cpu/uml.cpp b/src/devices/cpu/uml.cpp
index e01b34cdcb6..5b9785f792c 100644
--- a/src/devices/cpu/uml.cpp
+++ b/src/devices/cpu/uml.cpp
@@ -739,9 +739,8 @@ void uml::instruction::simplify()
/*
if (LOG_SIMPLIFICATIONS && memcmp(&orig, inst, sizeof(orig)) != 0)
{
- std::string disasm1, disasm2;
- orig.disasm(disasm1, block->drcuml);
- inst->disasm(disasm2, block->drcuml);
+ std::string disasm1 = orig.disasm(block->drcuml);
+ std::string disasm2 = inst->disasm(block->drcuml);
osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.c_str(), disasm2.c_str());
}
*/
@@ -854,7 +853,7 @@ UINT8 uml::instruction::modified_flags() const
// given buffer
//-------------------------------------------------
-const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml) const
+std::string uml::instruction::disasm(drcuml_state *drcuml) const
{
static const char *const conditions[] = { "z", "nz", "s", "ns", "c", "nc", "v", "nv", "u", "nu", "a", "be", "g", "le", "l", "ge" };
static const char *const pound_size[] = { "?", "?", "?", "?", "s", "?", "?", "?", "d" };
@@ -868,7 +867,7 @@ const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml)
assert(m_opcode != OP_INVALID && m_opcode < OP_MAX);
// start with the raw mnemonic and substitute sizes
- buffer.clear();
+ std::string buffer;
for (const char *opsrc = opinfo.mnemonic; *opsrc != 0; opsrc++)
if (*opsrc == '!')
strcatprintf(buffer, "%s", bang_size[m_size]);
@@ -1025,5 +1024,5 @@ const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml)
if (m_flags & FLAG_C)
buffer.push_back('C');
}
- return buffer.c_str();
+ return buffer;
}