From 3ec8f67ab29014ef11daa795048b611e063a9f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 21 Dec 2020 21:28:13 +0100 Subject: [PATCH 1/4] InfoScreen: drop unused member --- InfoScreen.h | 1 - 1 file changed, 1 deletion(-) diff --git a/InfoScreen.h b/InfoScreen.h index 0d80367d..d7497bed 100644 --- a/InfoScreen.h +++ b/InfoScreen.h @@ -16,7 +16,6 @@ typedef struct InfoScreen_ { Object super; const Process* process; Panel* display; - FunctionBar* bar; IncSet* inc; Vector* lines; } InfoScreen; From a7612b0b7d00a9b97eea25ae1b8af81fd7b591d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 21 Dec 2020 21:33:11 +0100 Subject: [PATCH 2/4] TraceScreen: mark local class functions static --- TraceScreen.c | 26 +++++++++++++------------- TraceScreen.h | 6 ------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/TraceScreen.c b/TraceScreen.c index e6bd1fb1..fc1243c1 100644 --- a/TraceScreen.c +++ b/TraceScreen.c @@ -35,16 +35,6 @@ static const char* const TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"}; static const int TraceScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27}; -const InfoScreenClass TraceScreen_class = { - .super = { - .extends = Class(Object), - .delete = TraceScreen_delete - }, - .draw = TraceScreen_draw, - .onErr = TraceScreen_updateTrace, - .onKey = TraceScreen_onKey, -}; - TraceScreen* TraceScreen_new(Process* process) { // This initializes all TraceScreen variables to "false" so only default = true ones need to be set below TraceScreen* this = xCalloc(1, sizeof(TraceScreen)); @@ -70,7 +60,7 @@ void TraceScreen_delete(Object* cast) { free(InfoScreen_done((InfoScreen*)this)); } -void TraceScreen_draw(InfoScreen* this) { +static void TraceScreen_draw(InfoScreen* this) { attrset(CRT_colors[PANEL_HEADER_FOCUS]); mvhline(0, 0, ' ', COLS); mvprintw(0, 0, "Trace of process %d - %s", this->process->pid, Process_getCommand(this->process)); @@ -131,7 +121,7 @@ err: return false; } -void TraceScreen_updateTrace(InfoScreen* super) { +static void TraceScreen_updateTrace(InfoScreen* super) { TraceScreen* this = (TraceScreen*) super; char buffer[1025]; @@ -176,7 +166,7 @@ void TraceScreen_updateTrace(InfoScreen* super) { } } -bool TraceScreen_onKey(InfoScreen* super, int ch) { +static bool TraceScreen_onKey(InfoScreen* super, int ch) { TraceScreen* this = (TraceScreen*) super; switch(ch) { case 'f': @@ -195,3 +185,13 @@ bool TraceScreen_onKey(InfoScreen* super, int ch) { this->follow = false; return false; } + +const InfoScreenClass TraceScreen_class = { + .super = { + .extends = Class(Object), + .delete = TraceScreen_delete + }, + .draw = TraceScreen_draw, + .onErr = TraceScreen_updateTrace, + .onKey = TraceScreen_onKey, +}; diff --git a/TraceScreen.h b/TraceScreen.h index 81920479..3a2902a1 100644 --- a/TraceScreen.h +++ b/TraceScreen.h @@ -32,12 +32,6 @@ TraceScreen* TraceScreen_new(Process* process); void TraceScreen_delete(Object* cast); -void TraceScreen_draw(InfoScreen* this); - bool TraceScreen_forkTracer(TraceScreen* this); -void TraceScreen_updateTrace(InfoScreen* super); - -bool TraceScreen_onKey(InfoScreen* super, int ch); - #endif From 64c05a1ed5ea2d3589fc8239ce9065fe786c02cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 21 Dec 2020 21:34:23 +0100 Subject: [PATCH 3/4] EnvScreen: mark local class functions static --- EnvScreen.c | 22 +++++++++++----------- EnvScreen.h | 4 ---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/EnvScreen.c b/EnvScreen.c index ae63d3e8..0cdc4cac 100644 --- a/EnvScreen.c +++ b/EnvScreen.c @@ -14,15 +14,6 @@ #include "XUtils.h" -const InfoScreenClass EnvScreen_class = { - .super = { - .extends = Class(Object), - .delete = EnvScreen_delete - }, - .scan = EnvScreen_scan, - .draw = EnvScreen_draw -}; - EnvScreen* EnvScreen_new(Process* process) { EnvScreen* this = xMalloc(sizeof(EnvScreen)); Object_setClass(this, Class(EnvScreen)); @@ -33,11 +24,11 @@ void EnvScreen_delete(Object* this) { free(InfoScreen_done((InfoScreen*)this)); } -void EnvScreen_draw(InfoScreen* this) { +static void EnvScreen_draw(InfoScreen* this) { InfoScreen_drawTitled(this, "Environment of process %d - %s", this->process->pid, Process_getCommand(this->process)); } -void EnvScreen_scan(InfoScreen* this) { +static void EnvScreen_scan(InfoScreen* this) { Panel* panel = this->display; int idx = MAXIMUM(Panel_getSelectedIndex(panel), 0); @@ -59,3 +50,12 @@ void EnvScreen_scan(InfoScreen* this) { Vector_insertionSort(panel->items); Panel_setSelected(panel, idx); } + +const InfoScreenClass EnvScreen_class = { + .super = { + .extends = Class(Object), + .delete = EnvScreen_delete + }, + .scan = EnvScreen_scan, + .draw = EnvScreen_draw +}; diff --git a/EnvScreen.h b/EnvScreen.h index bf385801..66d263fc 100644 --- a/EnvScreen.h +++ b/EnvScreen.h @@ -15,8 +15,4 @@ EnvScreen* EnvScreen_new(Process* process); void EnvScreen_delete(Object* this); -void EnvScreen_draw(InfoScreen* this); - -void EnvScreen_scan(InfoScreen* this); - #endif From cdfd407e2eb68c3bbb213b6a2de313ee0a7a2669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 21 Dec 2020 21:56:26 +0100 Subject: [PATCH 4/4] Panel_init: initialize selectedLen member --- Panel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Panel.c b/Panel.c index 37b9c4ef..d5b4f133 100644 --- a/Panel.c +++ b/Panel.c @@ -55,6 +55,7 @@ void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type this->scrollH = 0; this->selected = 0; this->oldSelected = 0; + this->selectedLen = 0; this->needsRedraw = true; RichString_beginAllocated(this->header); this->defaultBar = fuBar;