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.
This commit is contained in:
Christian Göttsche
2021-02-05 14:12:49 +01:00
parent fd1ad863dc
commit fd4e6b432b
5 changed files with 48 additions and 46 deletions

5
htop.c
View File

@ -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,