summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-09 16:20:46 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-09 16:20:46 +0100
commit971dd46aec0e06df26c5675aa0f49cbc4871283f (patch)
treeb9f08a9ab6cdca7a942782c8b1e5543b0ca9328f /Userland
parent0d5e6593b2b7abea5ab2b9814e6055f8fff69fb8 (diff)
downloadserenity-971dd46aec0e06df26c5675aa0f49cbc4871283f.zip
Userland: Use AK::quick_sort() in /bin/top
Diffstat (limited to 'Userland')
-rw-r--r--Userland/top.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/top.cpp b/Userland/top.cpp
index b14d9b0d99..a0c3350049 100644
--- a/Userland/top.cpp
+++ b/Userland/top.cpp
@@ -6,6 +6,7 @@
#include <AK/HashMap.h>
#include <AK/AKString.h>
#include <AK/Vector.h>
+#include <AK/QuickSort.h>
static HashMap<unsigned, String>* s_usernames;
@@ -112,10 +113,9 @@ int main(int, char**)
processes.append(&it.value);
}
- qsort(processes.data(), processes.size(), sizeof(Process*), [] (const void* a, const void* b) -> int {
- auto* p1 = *(const Process* const*)(a);
- auto* p2 = *(const Process* const*)(b);
- return p2->nsched_since_prev - p1->nsched_since_prev;
+
+ quick_sort(processes.begin(), processes.end(), [] (auto* p1, auto* p2) {
+ return p2->nsched_since_prev < p1->nsched_since_prev;
});
for (auto* process : processes) {