diff options
author | 2019-03-25 22:44:58 +0100 | |
---|---|---|
committer | 2019-03-25 22:44:58 +0100 | |
commit | c24473ddff715ecec2e258a6eb38960cf8c8e98e (patch) | |
tree | 8ea44b6396a6129913c0aac13859b5de9965e972 /src/emu/debug/dvbpoints.cpp | |
parent | 009cba4fb8102102168ef32870892438327f3705 (diff) | |
parent | 598cd5227223c3b04ca31f0dbc1981256d9ea3ff (diff) |
conflict resolution (nw)
Diffstat (limited to 'src/emu/debug/dvbpoints.cpp')
-rw-r--r-- | src/emu/debug/dvbpoints.cpp | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp index 6bc4a008c5f..3b76c7d26fe 100644 --- a/src/emu/debug/dvbpoints.cpp +++ b/src/emu/debug/dvbpoints.cpp @@ -12,79 +12,68 @@ #include "debugger.h" #include "dvbpoints.h" +#include <algorithm> #include <iomanip> // Sorting functors for the qsort function -static int cIndexAscending(const void* a, const void* b) +static bool cIndexAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)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::breakpoint *a, const device_debug::breakpoint *b) { return cIndexAscending(b, a); } -static int cEnabledAscending(const void* a, const void* b) +static bool cEnabledAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)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::breakpoint *a, const device_debug::breakpoint *b) { return cEnabledAscending(b, a); } -static int cCpuAscending(const void* a, const void* b) +static bool cCpuAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)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::breakpoint *a, const device_debug::breakpoint *b) { return cCpuAscending(b, a); } -static int cAddressAscending(const void* a, const void* b) +static bool cAddressAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)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::breakpoint *a, const device_debug::breakpoint *b) { return cAddressAscending(b, a); } -static int cConditionAscending(const void* a, const void* b) +static bool cConditionAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)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::breakpoint *a, const device_debug::breakpoint *b) { return cConditionAscending(b, a); } -static int cActionAscending(const void* a, const void* b) +static bool cActionAscending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { - const device_debug::breakpoint* left = *(device_debug::breakpoint**)a; - const device_debug::breakpoint* right = *(device_debug::breakpoint**)b; - return strcmp(left->action(), right->action()); + return strcmp(a->action(), b->action()) < 0; } -static int cActionDescending(const void* a, const void* b) +static bool cActionDescending(const device_debug::breakpoint *a, const device_debug::breakpoint *b) { return cActionAscending(b, a); } @@ -210,7 +199,7 @@ void debug_view_breakpoints::gather_breakpoints() // And now for the sort if (!m_buffer.empty()) - qsort(&m_buffer[0], m_buffer.size(), sizeof(device_debug::breakpoint *), m_sortType); + std::stable_sort(m_buffer.begin(), m_buffer.end(), m_sortType); } |