Merge pull request #5477 from npwoods/listxml_devices_sorted

Ensuring that devices emitted by -listxml are sorted
This commit is contained in:
R. Belmont 2019-08-13 13:21:53 -04:00 committed by GitHub
commit deb05745b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -1951,3 +1951,13 @@ const char *info_xml_creator::get_merge_name(driver_enumerator &drivlist, const
return nullptr;
}
//-------------------------------------------------
// device_type_compare::operator()
//-------------------------------------------------
bool info_xml_creator::device_type_compare::operator()(const std::add_pointer_t<device_type> &lhs, const std::add_pointer_t<device_type> &rhs) const
{
return strcmp(lhs->shortname(), rhs->shortname()) < 0;
}

View File

@ -39,7 +39,13 @@ public:
void output(std::ostream &out, const std::function<bool(const char *shortname, bool &done)> &filter = { }, bool include_devices = true);
private:
typedef std::unordered_set<std::add_pointer_t<device_type> > device_type_set;
class device_type_compare
{
public:
bool operator()(const std::add_pointer_t<device_type> &lhs, const std::add_pointer_t<device_type> &rhs) const;
};
typedef std::set<std::add_pointer_t<device_type>, device_type_compare> device_type_set;
// internal helper
void output_header(std::ostream &out);