mirror of https://github.com/xzeldon/htop.git
Avoid function cast by refactoring callback prototype
This commit is contained in:
parent
ce9e7fd14f
commit
7386c6fed0
12
MainPanel.c
12
MainPanel.c
|
@ -44,6 +44,11 @@ void MainPanel_pidSearch(MainPanel* this, int ch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* MainPanel_getValue(Panel* this, int i) {
|
||||||
|
const Process* p = (const Process*) Panel_get(this, i);
|
||||||
|
return Process_getCommand(p);
|
||||||
|
}
|
||||||
|
|
||||||
static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
|
static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
|
||||||
MainPanel* this = (MainPanel*) super;
|
MainPanel* this = (MainPanel*) super;
|
||||||
|
|
||||||
|
@ -77,7 +82,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
|
||||||
reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS;
|
reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS;
|
||||||
result = HANDLED;
|
result = HANDLED;
|
||||||
} else if (ch != ERR && this->inc->active) {
|
} else if (ch != ERR && this->inc->active) {
|
||||||
bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL);
|
bool filterChanged = IncSet_handleKey(this->inc, ch, super, MainPanel_getValue, NULL);
|
||||||
if (filterChanged) {
|
if (filterChanged) {
|
||||||
this->state->pl->incFilter = IncSet_filter(this->inc);
|
this->state->pl->incFilter = IncSet_filter(this->inc);
|
||||||
reaction = HTOP_REFRESH | HTOP_REDRAW_BAR;
|
reaction = HTOP_REFRESH | HTOP_REDRAW_BAR;
|
||||||
|
@ -136,11 +141,6 @@ int MainPanel_selectedPid(MainPanel* this) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MainPanel_getValue(MainPanel* this, int i) {
|
|
||||||
Process* p = (Process*) Panel_get((Panel*)this, i);
|
|
||||||
return Process_getCommand(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged) {
|
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged) {
|
||||||
Panel* super = (Panel*) this;
|
Panel* super = (Panel*) this;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
|
@ -38,8 +38,6 @@ void MainPanel_pidSearch(MainPanel* this, int ch);
|
||||||
|
|
||||||
int MainPanel_selectedPid(MainPanel* this);
|
int MainPanel_selectedPid(MainPanel* this);
|
||||||
|
|
||||||
const char* MainPanel_getValue(MainPanel* this, int i);
|
|
||||||
|
|
||||||
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged);
|
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged);
|
||||||
|
|
||||||
extern const PanelClass MainPanel_class;
|
extern const PanelClass MainPanel_class;
|
||||||
|
|
Loading…
Reference in New Issue