summaryrefslogtreecommitdiffstats
path: root/linux/Platform.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-02-05 14:12:49 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-02-05 14:12:49 +0100
commitfd4e6b432bcc0d6bac1a15a2ea492b4a540b75a1 (patch)
tree559e4dde1887a4f75b10309e2eddbf6843497ef0 /linux/Platform.c
parentfd1ad863dca36da7166d9767218f5382074de4d2 (diff)
Use MainPanel type in State struct
The State struct holds a pointer to the main process panel. Use the distinct MainPanel type, to improve maintainability regrading its usage. This avoids usages of down-casts from Panel to MainPanel, only up-casts from MainPanel to Panel are now required.
Diffstat (limited to 'linux/Platform.c')
-rw-r--r--linux/Platform.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/linux/Platform.c b/linux/Platform.c
index 7bf93b17..80b276ef 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -130,9 +130,7 @@ void Platform_done(void) {
}
static Htop_Reaction Platform_actionSetIOPriority(State* st) {
- Panel* panel = st->panel;
-
- const LinuxProcess* p = (const LinuxProcess*) Panel_getSelected(panel);
+ const LinuxProcess* p = (const LinuxProcess*) Panel_getSelected((Panel*)st->mainPanel);
if (!p)
return HTOP_OK;
@@ -141,7 +139,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
const void* set = Action_pickFromVector(st, ioprioPanel, 21, true);
if (set) {
IOPriority ioprio2 = IOPriorityPanel_getIOPriority(ioprioPanel);
- bool ok = MainPanel_foreachProcess((MainPanel*)panel, LinuxProcess_setIOPriority, (Arg) { .i = ioprio2 }, NULL);
+ bool ok = MainPanel_foreachProcess(st->mainPanel, LinuxProcess_setIOPriority, (Arg) { .i = ioprio2 }, NULL);
if (!ok) {
beep();
}

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