summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2019-08-25 20:07:25 +1000
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-08-25 20:07:25 +1000
commit05aac20ab6e6a2a13cdd2ad10b66a725b3dbc238 (patch)
tree146a5f4c545db5e8f204bd2b800d3e2013aff81e /src/frontend
parent7031c31c00eb947993fa2b7a6157b6778812a9dd (diff)
strtok is not reentrant - it's not safe to call it any time you might be multi-threaded (nw)
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/info.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp
index 5be974239d9..b06453c0958 100644
--- a/src/frontend/mame/info.cpp
+++ b/src/frontend/mame/info.cpp
@@ -1855,21 +1855,22 @@ void output_images(std::ostream &out, device_t &device, const char *root_tag)
if (loadable)
{
- const char *name = imagedev.instance_name().c_str();
- const char *shortname = imagedev.brief_instance_name().c_str();
+ char const *const name = imagedev.instance_name().c_str();
+ char const *const shortname = imagedev.brief_instance_name().c_str();
out << "\t\t\t<instance";
out << util::string_format(" name=\"%s\"", normalize_string(name));
out << util::string_format(" briefname=\"%s\"", normalize_string(shortname));
out << "/>\n";
- std::string extensions(imagedev.file_extensions());
-
- char *ext = strtok((char *)extensions.c_str(), ",");
- while (ext != nullptr)
+ char const *extensions(imagedev.file_extensions());
+ while (extensions)
{
- out << util::string_format("\t\t\t<extension name=\"%s\"/>\n", normalize_string(ext));
- ext = strtok(nullptr, ",");
+ char const *end(extensions);
+ while (*end && (',' != *end))
+ ++end;
+ out << util::string_format("\t\t\t<extension name=\"%s\"/>\n", normalize_string(std::string(extensions, end).c_str()));
+ extensions = *end ? (end + 1) : nullptr;
}
}
out << "\t\t</device>\n";