diff options
author | 2019-03-26 11:13:37 +1100 | |
---|---|---|
committer | 2019-03-26 11:13:37 +1100 | |
commit | 97b67170277437131adf6ed4d60139c172529e4f (patch) | |
tree | 7a5cbf608f191075f1612b1af15832c206a3fe2d /src/emu/debug/dvwpoints.cpp | |
parent | b380514764cf857469bae61c11143a19f79a74c5 (diff) |
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and
c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at
598cd5227223c3b04ca31f0dbc1981256d9ea3ff.
Before pushing, please check that what you're about to push is sane.
Check your local commit log and ensure there isn't anything out-of-place
before pushing to mainline. When things like this happen, it wastes
everyone's time. I really don't need this in a week when real work⢠is
busting my balls and I'm behind where I want to be with preparing for
MAME release.
Diffstat (limited to 'src/emu/debug/dvwpoints.cpp')
-rw-r--r-- | src/emu/debug/dvwpoints.cpp | 67 |
1 files changed, 26 insertions, 41 deletions
diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp index 2ab1fc6a0bf..b0584b5d61c 100644 --- a/src/emu/debug/dvwpoints.cpp +++ b/src/emu/debug/dvwpoints.cpp @@ -11,102 +11,87 @@ #include "emu.h" #include "dvwpoints.h" +#include <algorithm> #include <iomanip> -static int cIndexAscending(const void* a, const void* b) +static bool cIndexAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return left->index() - right->index(); + return a->index() < b->index(); } -static int cIndexDescending(const void* a, const void* b) +static bool cIndexDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cIndexAscending(b, a); } -static int cEnabledAscending(const void* a, const void* b) +static bool cEnabledAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return (left->enabled() ? 1 : 0) - (right->enabled() ? 1 : 0); + return !a->enabled() && b->enabled(); } -static int cEnabledDescending(const void* a, const void* b) +static bool cEnabledDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cEnabledAscending(b, a); } -static int cCpuAscending(const void* a, const void* b) +static bool cCpuAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return strcmp(left->debugInterface()->device().tag(), right->debugInterface()->device().tag()); + return strcmp(a->debugInterface()->device().tag(), b->debugInterface()->device().tag()) < 0; } -static int cCpuDescending(const void* a, const void* b) +static bool cCpuDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cCpuAscending(b, a); } -static int cSpaceAscending(const void* a, const void* b) +static bool cSpaceAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return strcmp(left->space().name(), right->space().name()); + return strcmp(a->space().name(), b->space().name()) < 0; } -static int cSpaceDescending(const void* a, const void* b) +static bool cSpaceDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cSpaceAscending(b, a); } -static int cAddressAscending(const void* a, const void* b) +static bool cAddressAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return (left->address() > right->address()) ? 1 : (left->address() < right->address()) ? -1 : 0; + return a->address() < b->address(); } -static int cAddressDescending(const void* a, const void* b) +static bool cAddressDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cAddressAscending(b, a); } -static int cTypeAscending(const void* a, const void* b) +static bool cTypeAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return int(left->type()) - int(right->type()); + return int(a->type()) < int(b->type()); } -static int cTypeDescending(const void* a, const void* b) +static bool cTypeDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cTypeAscending(b, a); } -static int cConditionAscending(const void* a, const void* b) +static bool cConditionAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return strcmp(left->condition(), right->condition()); + return strcmp(a->condition(), b->condition()) < 0; } -static int cConditionDescending(const void* a, const void* b) +static bool cConditionDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cConditionAscending(b, a); } -static int cActionAscending(const void* a, const void* b) +static bool cActionAscending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { - const device_debug::watchpoint* left = *(device_debug::watchpoint**)a; - const device_debug::watchpoint* right = *(device_debug::watchpoint**)b; - return left->action().compare(right->action()); + return a->action() < b->action(); } -static int cActionDescending(const void* a, const void* b) +static bool cActionDescending(const device_debug::watchpoint *a, const device_debug::watchpoint *b) { return cActionAscending(b, a); } @@ -236,7 +221,7 @@ void debug_view_watchpoints::gather_watchpoints() // And now for the sort if (!m_buffer.empty()) - qsort(&m_buffer[0], m_buffer.size(), sizeof(device_debug::watchpoint *), m_sortType); + std::stable_sort(m_buffer.begin(), m_buffer.end(), m_sortType); } |