mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Use std::sort instead of qsort in listdevices (nw)
This commit is contained in:
parent
36ba346bfb
commit
ecf9eeefc2
@ -30,6 +30,7 @@
|
||||
#include "language.h"
|
||||
#include "pluginopts.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <new>
|
||||
#include <ctype.h>
|
||||
|
||||
@ -650,13 +651,6 @@ void cli_frontend::listsamples(const char *gamename)
|
||||
// referenced by a given game or set of games
|
||||
//-------------------------------------------------
|
||||
|
||||
int cli_frontend::compare_devices(const void *i1, const void *i2)
|
||||
{
|
||||
device_t *dev1 = *(device_t **)i1;
|
||||
device_t *dev2 = *(device_t **)i2;
|
||||
return strcmp(dev1->tag(), dev2->tag());
|
||||
}
|
||||
|
||||
void cli_frontend::listdevices(const char *gamename)
|
||||
{
|
||||
// determine which drivers to output; return an error if none found
|
||||
@ -680,7 +674,9 @@ void cli_frontend::listdevices(const char *gamename)
|
||||
device_list.push_back(&device);
|
||||
|
||||
// sort them by tag
|
||||
qsort(&device_list[0], device_list.size(), sizeof(device_list[0]), compare_devices);
|
||||
std::sort(device_list.begin(), device_list.end(), [](device_t *dev1, device_t *dev2) {
|
||||
return strcmp(dev1->tag(), dev2->tag()) < 0;
|
||||
});
|
||||
|
||||
// dump the results
|
||||
for (auto device : device_list)
|
||||
|
@ -43,7 +43,6 @@ public:
|
||||
void listcrc(const char *gamename = "*");
|
||||
void listroms(const char *gamename = "*");
|
||||
void listsamples(const char *gamename = "*");
|
||||
static int compare_devices(const void *i1, const void *i2);
|
||||
void listdevices(const char *gamename = "*");
|
||||
void listslots(const char *gamename = "*");
|
||||
void listmedia(const char *gamename = "*");
|
||||
|
Loading…
Reference in New Issue
Block a user