summaryrefslogtreecommitdiffstats
path: root/Process.h
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-12-18 22:12:26 +0100
committerBenBE <BenBE@geshi.org>2020-12-19 16:02:34 +0100
commit77db240b4851a5c739ff48de9d383707dcbfc490 (patch)
tree4351fe69c53716241d6d61653fc9c217556f220e /Process.h
parent2327260ee888146beab3da66507c7744334a6973 (diff)
Split boilerplate and platform-independent field comparison
This acheives two things: - Allows for simple tie-breaking if values compare equal (needed to make sorting the tree-view stable) - Allows for platform-dependent overriding of the sort-order for specific fields Also fixes a small oversight on DragonFlyBSD when default-sorting.
Diffstat (limited to 'Process.h')
-rw-r--r--Process.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Process.h b/Process.h
index 9e800891..b58135ed 100644
--- a/Process.h
+++ b/Process.h
@@ -142,7 +142,7 @@ typedef struct ProcessClass_ {
#define As_Process(this_) ((const ProcessClass*)((this_)->super.klass))
#define Process_getCommand(this_) (As_Process(this_)->getCommandStr ? As_Process(this_)->getCommandStr((const Process*)(this_)) : ((const Process*)(this_))->comm)
-#define Process_compareByKey(p1_, p2_, key_) (As_Process(p1_)->compareByKey ? (As_Process(p1_)->compareByKey(p1_, p2_, key_)) : SPACESHIP_NUMBER(p1->pid, p2->pid))
+#define Process_compareByKey(p1_, p2_, key_) (As_Process(p1_)->compareByKey ? (As_Process(p1_)->compareByKey(p1_, p2_, key_)) : Process_compareByKey_Base(p1_, p2_, key_))
static inline pid_t Process_getParentPid(const Process* this) {
return this->tgid == this->pid ? this->ppid : this->tgid;
@@ -199,4 +199,6 @@ bool Process_sendSignal(Process* this, Arg sgn);
long Process_pidCompare(const void* v1, const void* v2);
+long Process_compareByKey_Base(const Process* p1, const Process* p2, ProcessField key);
+
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy