From fd4e6b432bcc0d6bac1a15a2ea492b4a540b75a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 5 Feb 2021 14:12:49 +0100 Subject: 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. --- htop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'htop.c') diff --git a/htop.c b/htop.c index 51f2f4e3..65ad21e4 100644 --- a/htop.c +++ b/htop.c @@ -294,9 +294,8 @@ static void millisleep(unsigned long millisec) { } static void setCommFilter(State* state, char** commFilter) { - MainPanel* panel = (MainPanel*)state->panel; ProcessList* pl = state->pl; - IncSet* inc = panel->inc; + IncSet* inc = state->mainPanel->inc; IncSet_setFilter(inc, *commFilter); pl->incFilter = IncSet_filter(inc); @@ -453,7 +452,7 @@ int main(int argc, char** argv) { .settings = settings, .ut = ut, .pl = pl, - .panel = (Panel*) panel, + .mainPanel = panel, .header = header, .pauseProcessUpdate = false, .hideProcessSelection = false, -- cgit v1.2.3