Mark Object instances const

This commit is contained in:
Christian Göttsche 2020-10-05 13:19:50 +02:00 committed by cgzones
parent 08d85e6143
commit ba282cfe19
76 changed files with 111 additions and 111 deletions

View File

@ -319,7 +319,7 @@ static MaskItem *AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t ob
#endif #endif
PanelClass AffinityPanel_class = { const PanelClass AffinityPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = AffinityPanel_delete .delete = AffinityPanel_delete

View File

@ -11,7 +11,7 @@ in the source distribution for its full text.
#include "Affinity.h" #include "Affinity.h"
#include "ProcessList.h" #include "ProcessList.h"
extern PanelClass AffinityPanel_class; extern const PanelClass AffinityPanel_class;
Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width); Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width);

View File

@ -57,7 +57,7 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass AvailableColumnsPanel_class = { const PanelClass AvailableColumnsPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = AvailableColumnsPanel_delete .delete = AvailableColumnsPanel_delete

View File

@ -14,7 +14,7 @@ typedef struct AvailableColumnsPanel_ {
Panel* columns; Panel* columns;
} AvailableColumnsPanel; } AvailableColumnsPanel;
extern PanelClass AvailableColumnsPanel_class; extern const PanelClass AvailableColumnsPanel_class;
AvailableColumnsPanel* AvailableColumnsPanel_new(Panel* columns); AvailableColumnsPanel* AvailableColumnsPanel_new(Panel* columns);

View File

@ -24,7 +24,7 @@ static void AvailableMetersPanel_delete(Object* object) {
free(this); free(this);
} }
static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, MeterClass* type, int param, int column) { static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, const MeterClass* type, int param, int column) {
Meter* meter = Header_addMeterByClass(header, type, param, column); Meter* meter = Header_addMeterByClass(header, type, param, column);
Panel_add(panel, (Object*) Meter_toListItem(meter, false)); Panel_add(panel, (Object*) Meter_toListItem(meter, false));
Panel_setSelected(panel, Panel_size(panel) - 1); Panel_setSelected(panel, Panel_size(panel) - 1);
@ -77,7 +77,7 @@ static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass AvailableMetersPanel_class = { const PanelClass AvailableMetersPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = AvailableMetersPanel_delete .delete = AvailableMetersPanel_delete
@ -101,13 +101,13 @@ AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* heade
// Platform_meterTypes[0] should be always (&CPUMeter_class), which we will // Platform_meterTypes[0] should be always (&CPUMeter_class), which we will
// handle separately in the code below. // handle separately in the code below.
for (int i = 1; Platform_meterTypes[i]; i++) { for (int i = 1; Platform_meterTypes[i]; i++) {
MeterClass* type = Platform_meterTypes[i]; const MeterClass* type = Platform_meterTypes[i];
assert(type != &CPUMeter_class); assert(type != &CPUMeter_class);
const char* label = type->description ? type->description : type->uiName; const char* label = type->description ? type->description : type->uiName;
Panel_add(super, (Object*) ListItem_new(label, i << 16)); Panel_add(super, (Object*) ListItem_new(label, i << 16));
} }
// Handle (&CPUMeter_class) // Handle (&CPUMeter_class)
MeterClass* type = &CPUMeter_class; const MeterClass* type = &CPUMeter_class;
int cpus = pl->cpuCount; int cpus = pl->cpuCount;
if (cpus > 1) { if (cpus > 1) {
Panel_add(super, (Object*) ListItem_new("CPU average", 0)); Panel_add(super, (Object*) ListItem_new("CPU average", 0));

View File

@ -22,7 +22,7 @@ typedef struct AvailableMetersPanel_ {
Panel* rightPanel; Panel* rightPanel;
} AvailableMetersPanel; } AvailableMetersPanel;
extern PanelClass AvailableMetersPanel_class; extern const PanelClass AvailableMetersPanel_class;
AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* header, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr, ProcessList* pl); AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* header, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr, ProcessList* pl);

View File

@ -58,7 +58,7 @@ static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) {
} }
} }
MeterClass BatteryMeter_class = { const MeterClass BatteryMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -17,6 +17,6 @@ typedef enum ACPresence_ {
AC_ERROR AC_ERROR
} ACPresence; } ACPresence;
extern MeterClass BatteryMeter_class; extern const MeterClass BatteryMeter_class;
#endif #endif

View File

@ -246,7 +246,7 @@ static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) {
} }
MeterClass CPUMeter_class = { const MeterClass CPUMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -263,7 +263,7 @@ MeterClass CPUMeter_class = {
.init = CPUMeter_init .init = CPUMeter_init
}; };
MeterClass AllCPUsMeter_class = { const MeterClass AllCPUsMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -282,7 +282,7 @@ MeterClass AllCPUsMeter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass AllCPUs2Meter_class = { const MeterClass AllCPUs2Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -301,7 +301,7 @@ MeterClass AllCPUs2Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass LeftCPUsMeter_class = { const MeterClass LeftCPUsMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -320,7 +320,7 @@ MeterClass LeftCPUsMeter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass RightCPUsMeter_class = { const MeterClass RightCPUsMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -339,7 +339,7 @@ MeterClass RightCPUsMeter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass LeftCPUs2Meter_class = { const MeterClass LeftCPUs2Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -358,7 +358,7 @@ MeterClass LeftCPUs2Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass RightCPUs2Meter_class = { const MeterClass RightCPUs2Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -377,7 +377,7 @@ MeterClass RightCPUs2Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass AllCPUs4Meter_class = { const MeterClass AllCPUs4Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -396,7 +396,7 @@ MeterClass AllCPUs4Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass LeftCPUs4Meter_class = { const MeterClass LeftCPUs4Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -415,7 +415,7 @@ MeterClass LeftCPUs4Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass RightCPUs4Meter_class = { const MeterClass RightCPUs4Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -434,7 +434,7 @@ MeterClass RightCPUs4Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass AllCPUs8Meter_class = { const MeterClass AllCPUs8Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -453,7 +453,7 @@ MeterClass AllCPUs8Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass LeftCPUs8Meter_class = { const MeterClass LeftCPUs8Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -472,7 +472,7 @@ MeterClass LeftCPUs8Meter_class = {
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass RightCPUs8Meter_class = { const MeterClass RightCPUs8Meter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -22,30 +22,30 @@ typedef enum {
CPU_METER_ITEMCOUNT = 9, // number of entries in this enum CPU_METER_ITEMCOUNT = 9, // number of entries in this enum
} CPUMeterValues; } CPUMeterValues;
extern MeterClass CPUMeter_class; extern const MeterClass CPUMeter_class;
extern MeterClass AllCPUsMeter_class; extern const MeterClass AllCPUsMeter_class;
extern MeterClass AllCPUs2Meter_class; extern const MeterClass AllCPUs2Meter_class;
extern MeterClass LeftCPUsMeter_class; extern const MeterClass LeftCPUsMeter_class;
extern MeterClass RightCPUsMeter_class; extern const MeterClass RightCPUsMeter_class;
extern MeterClass LeftCPUs2Meter_class; extern const MeterClass LeftCPUs2Meter_class;
extern MeterClass RightCPUs2Meter_class; extern const MeterClass RightCPUs2Meter_class;
extern MeterClass AllCPUs4Meter_class; extern const MeterClass AllCPUs4Meter_class;
extern MeterClass LeftCPUs4Meter_class; extern const MeterClass LeftCPUs4Meter_class;
extern MeterClass RightCPUs4Meter_class; extern const MeterClass RightCPUs4Meter_class;
extern MeterClass AllCPUs8Meter_class; extern const MeterClass AllCPUs8Meter_class;
extern MeterClass LeftCPUs8Meter_class; extern const MeterClass LeftCPUs8Meter_class;
extern MeterClass RightCPUs8Meter_class; extern const MeterClass RightCPUs8Meter_class;
#endif #endif

View File

@ -109,7 +109,7 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass CategoriesPanel_class = { const PanelClass CategoriesPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = CategoriesPanel_delete .delete = CategoriesPanel_delete

View File

@ -23,7 +23,7 @@ typedef struct CategoriesPanel_ {
void CategoriesPanel_makeMetersPage(CategoriesPanel* this); void CategoriesPanel_makeMetersPage(CategoriesPanel* this);
extern PanelClass CategoriesPanel_class; extern const PanelClass CategoriesPanel_class;
CategoriesPanel* CategoriesPanel_new(ScreenManager* scr, Settings* settings, Header* header, ProcessList* pl); CategoriesPanel* CategoriesPanel_new(ScreenManager* scr, Settings* settings, Header* header, ProcessList* pl);

View File

@ -33,7 +33,7 @@ static void CheckItem_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CHECK_TEXT], this->text); RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
} }
ObjectClass CheckItem_class = { const ObjectClass CheckItem_class = {
.display = CheckItem_display, .display = CheckItem_display,
.delete = CheckItem_delete .delete = CheckItem_delete
}; };

View File

@ -16,7 +16,7 @@ typedef struct CheckItem_ {
bool value; bool value;
} CheckItem; } CheckItem;
extern ObjectClass CheckItem_class; extern const ObjectClass CheckItem_class;
CheckItem* CheckItem_newByRef(char* text, bool* ref); CheckItem* CheckItem_newByRef(char* text, bool* ref);

View File

@ -24,7 +24,7 @@ static void ClockMeter_updateValues(Meter* this, char* buffer, int size) {
strftime(buffer, size, "%H:%M:%S", lt); strftime(buffer, size, "%H:%M:%S", lt);
} }
MeterClass ClockMeter_class = { const MeterClass ClockMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass ClockMeter_class; extern const MeterClass ClockMeter_class;
#endif #endif

View File

@ -76,7 +76,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass ColorsPanel_class = { const PanelClass ColorsPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = ColorsPanel_delete .delete = ColorsPanel_delete

View File

@ -18,7 +18,7 @@ typedef struct ColorsPanel_ {
ScreenManager* scr; ScreenManager* scr;
} ColorsPanel; } ColorsPanel;
extern PanelClass ColorsPanel_class; extern const PanelClass ColorsPanel_class;
ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr); ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr);

View File

@ -105,7 +105,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass ColumnsPanel_class = { const PanelClass ColumnsPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = ColumnsPanel_delete .delete = ColumnsPanel_delete

View File

@ -17,7 +17,7 @@ typedef struct ColumnsPanel_ {
bool moving; bool moving;
} ColumnsPanel; } ColumnsPanel;
extern PanelClass ColumnsPanel_class; extern const PanelClass ColumnsPanel_class;
ColumnsPanel* ColumnsPanel_new(Settings* settings); ColumnsPanel* ColumnsPanel_new(Settings* settings);

View File

@ -48,7 +48,7 @@ static void CommandScreen_draw(InfoScreen* this) {
InfoScreen_drawTitled(this, "Command of process %d - %s", this->process->pid, this->process->comm); InfoScreen_drawTitled(this, "Command of process %d - %s", this->process->pid, this->process->comm);
} }
InfoScreenClass CommandScreen_class = { const InfoScreenClass CommandScreen_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.delete = CommandScreen_delete .delete = CommandScreen_delete

View File

@ -7,7 +7,7 @@ typedef struct CommandScreen_ {
InfoScreen super; InfoScreen super;
} CommandScreen; } CommandScreen;
extern InfoScreenClass CommandScreen_class; extern const InfoScreenClass CommandScreen_class;
CommandScreen* CommandScreen_new(Process* process); CommandScreen* CommandScreen_new(Process* process);

View File

@ -31,7 +31,7 @@ static void DateMeter_updateValues(Meter* this, char* buffer, int size) {
strftime(buffer, size, "%F", lt); strftime(buffer, size, "%F", lt);
} }
MeterClass DateMeter_class = { const MeterClass DateMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass DateMeter_class; extern const MeterClass DateMeter_class;
#endif #endif

View File

@ -31,7 +31,7 @@ static void DateTimeMeter_updateValues(Meter* this, char* buffer, int size) {
strftime(buffer, size, "%F %H:%M:%S", lt); strftime(buffer, size, "%F %H:%M:%S", lt);
} }
MeterClass DateTimeMeter_class = { const MeterClass DateTimeMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass DateTimeMeter_class; extern const MeterClass DateTimeMeter_class;
#endif #endif

View File

@ -75,7 +75,7 @@ static void DIskIOMeter_display(ATTR_UNUSED Object* cast, RichString* out) {
RichString_append(out, CRT_colors[DISKIO_WRITE], buffer); RichString_append(out, CRT_colors[DISKIO_WRITE], buffer);
} }
MeterClass DiskIOMeter_class = { const MeterClass DiskIOMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass DiskIOMeter_class; extern const MeterClass DiskIOMeter_class;
#endif /* HEADER_DiskIOMeter */ #endif /* HEADER_DiskIOMeter */

View File

@ -52,7 +52,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass DisplayOptionsPanel_class = { const PanelClass DisplayOptionsPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = DisplayOptionsPanel_delete .delete = DisplayOptionsPanel_delete

View File

@ -18,7 +18,7 @@ typedef struct DisplayOptionsPanel_ {
ScreenManager* scr; ScreenManager* scr;
} DisplayOptionsPanel; } DisplayOptionsPanel;
extern PanelClass DisplayOptionsPanel_class; extern const PanelClass DisplayOptionsPanel_class;
DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr); DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr);

View File

@ -12,7 +12,7 @@
#include <unistd.h> #include <unistd.h>
InfoScreenClass EnvScreen_class = { const InfoScreenClass EnvScreen_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.delete = EnvScreen_delete .delete = EnvScreen_delete

View File

@ -7,7 +7,7 @@ typedef struct EnvScreen_ {
InfoScreen super; InfoScreen super;
} EnvScreen; } EnvScreen;
extern InfoScreenClass EnvScreen_class; extern const InfoScreenClass EnvScreen_class;
EnvScreen* EnvScreen_new(Process* process); EnvScreen* EnvScreen_new(Process* process);

View File

@ -88,7 +88,7 @@ MeterModeId Header_addMeterByName(Header* this, char* name, int column) {
*paren = '\0'; *paren = '\0';
} }
MeterModeId mode = TEXT_METERMODE; MeterModeId mode = TEXT_METERMODE;
for (MeterClass** type = Platform_meterTypes; *type; type++) { for (const MeterClass* const* type = Platform_meterTypes; *type; type++) {
if (String_eq(name, (*type)->name)) { if (String_eq(name, (*type)->name)) {
Meter* meter = Meter_new(this->pl, param, *type); Meter* meter = Meter_new(this->pl, param, *type);
Vector_add(meters, meter); Vector_add(meters, meter);
@ -110,7 +110,7 @@ void Header_setMode(Header* this, int i, MeterModeId mode, int column) {
Meter_setMode(meter, mode); Meter_setMode(meter, mode);
} }
Meter* Header_addMeterByClass(Header* this, MeterClass* type, int param, int column) { Meter* Header_addMeterByClass(Header* this, const MeterClass* type, int param, int column) {
Vector* meters = this->columns[column]; Vector* meters = this->columns[column];
Meter* meter = Meter_new(this->pl, param, type); Meter* meter = Meter_new(this->pl, param, type);

View File

@ -34,7 +34,7 @@ MeterModeId Header_addMeterByName(Header* this, char* name, int column);
void Header_setMode(Header* this, int i, MeterModeId mode, int column); void Header_setMode(Header* this, int i, MeterModeId mode, int column);
Meter* Header_addMeterByClass(Header* this, MeterClass* type, int param, int column); Meter* Header_addMeterByClass(Header* this, const MeterClass* type, int param, int column);
int Header_size(Header* this, int column); int Header_size(Header* this, int column);

View File

@ -21,7 +21,7 @@ static void HostnameMeter_updateValues(Meter* this, char* buffer, int size) {
gethostname(buffer, size-1); gethostname(buffer, size-1);
} }
MeterClass HostnameMeter_class = { const MeterClass HostnameMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass HostnameMeter_class; extern const MeterClass HostnameMeter_class;
#endif #endif

View File

@ -42,7 +42,7 @@ static void ListItem_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[DEFAULT_COLOR], this->value/*buffer*/); RichString_append(out, CRT_colors[DEFAULT_COLOR], this->value/*buffer*/);
} }
ObjectClass ListItem_class = { const ObjectClass ListItem_class = {
.display = ListItem_display, .display = ListItem_display,
.delete = ListItem_delete, .delete = ListItem_delete,
.compare = ListItem_compare .compare = ListItem_compare

View File

@ -16,7 +16,7 @@ typedef struct ListItem_ {
bool moving; bool moving;
} ListItem; } ListItem;
extern ObjectClass ListItem_class; extern const ObjectClass ListItem_class;
ListItem* ListItem_new(const char* value, int key); ListItem* ListItem_new(const char* value, int key);

View File

@ -53,7 +53,7 @@ static void LoadMeter_display(Object* cast, RichString* out) {
RichString_write(out, CRT_colors[LOAD], buffer); RichString_write(out, CRT_colors[LOAD], buffer);
} }
MeterClass LoadAverageMeter_class = { const MeterClass LoadAverageMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,
@ -70,7 +70,7 @@ MeterClass LoadAverageMeter_class = {
.caption = "Load average: " .caption = "Load average: "
}; };
MeterClass LoadMeter_class = { const MeterClass LoadMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -9,8 +9,8 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass LoadAverageMeter_class; extern const MeterClass LoadAverageMeter_class;
extern MeterClass LoadMeter_class; extern const MeterClass LoadMeter_class;
#endif #endif

View File

@ -150,7 +150,7 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar
return ok; return ok;
} }
PanelClass MainPanel_class = { const PanelClass MainPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = MainPanel_delete .delete = MainPanel_delete

View File

@ -34,7 +34,7 @@ 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 PanelClass MainPanel_class; extern const PanelClass MainPanel_class;
MainPanel* MainPanel_new(void); MainPanel* MainPanel_new(void);

View File

@ -53,7 +53,7 @@ static void MemoryMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[MEMORY_CACHE], buffer); RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);
} }
MeterClass MemoryMeter_class = { const MeterClass MemoryMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass MemoryMeter_class; extern const MeterClass MemoryMeter_class;
#endif #endif

View File

@ -21,7 +21,7 @@ in the source distribution for its full text.
#define GRAPH_HEIGHT 4 /* Unit: rows (lines) */ #define GRAPH_HEIGHT 4 /* Unit: rows (lines) */
MeterClass Meter_class = { const MeterClass Meter_class = {
.super = { .super = {
.extends = Class(Object) .extends = Class(Object)
} }
@ -115,7 +115,7 @@ void Meter_setMode(Meter* this, int modeIndex) {
free(this->drawData); free(this->drawData);
this->drawData = NULL; this->drawData = NULL;
MeterMode* mode = Meter_modes[modeIndex]; const MeterMode* mode = Meter_modes[modeIndex];
this->draw = mode->draw; this->draw = mode->draw;
this->h = mode->h; this->h = mode->h;
} }
@ -410,7 +410,7 @@ static MeterMode LEDMeterMode = {
.draw = LEDMeterMode_draw, .draw = LEDMeterMode_draw,
}; };
MeterMode* Meter_modes[] = { const MeterMode* const Meter_modes[] = {
NULL, NULL,
&BarMeterMode, &BarMeterMode,
&TextMeterMode, &TextMeterMode,
@ -437,7 +437,7 @@ static const int BlankMeter_attributes[] = {
DEFAULT_COLOR DEFAULT_COLOR
}; };
MeterClass BlankMeter_class = { const MeterClass BlankMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -88,7 +88,7 @@ typedef struct GraphData_ {
double values[METER_BUFFER_LEN]; double values[METER_BUFFER_LEN];
} GraphData; } GraphData;
extern MeterClass Meter_class; extern const MeterClass Meter_class;
Meter* Meter_new(struct ProcessList_* pl, int param, const MeterClass* type); Meter* Meter_new(struct ProcessList_* pl, int param, const MeterClass* type);
@ -102,8 +102,8 @@ void Meter_setMode(Meter* this, int modeIndex);
ListItem* Meter_toListItem(Meter* this, bool moving); ListItem* Meter_toListItem(Meter* this, bool moving);
extern MeterMode* Meter_modes[]; extern const MeterMode* const Meter_modes[];
extern MeterClass BlankMeter_class; extern const MeterClass BlankMeter_class;
#endif #endif

View File

@ -186,7 +186,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
return result; return result;
} }
PanelClass MetersPanel_class = { const PanelClass MetersPanel_class = {
.super = { .super = {
.extends = Class(Panel), .extends = Class(Panel),
.delete = MetersPanel_delete .delete = MetersPanel_delete

View File

@ -28,7 +28,7 @@ void MetersPanel_cleanup(void);
void MetersPanel_setMoving(MetersPanel* this, bool moving); void MetersPanel_setMoving(MetersPanel* this, bool moving);
extern PanelClass MetersPanel_class; extern const PanelClass MetersPanel_class;
MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr); MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr);

View File

@ -24,7 +24,7 @@ in the source distribution for its full text.
#include <sys/wait.h> #include <sys/wait.h>
InfoScreenClass OpenFilesScreen_class = { const InfoScreenClass OpenFilesScreen_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.delete = OpenFilesScreen_delete .delete = OpenFilesScreen_delete

View File

@ -29,7 +29,7 @@ typedef struct OpenFilesScreen_ {
pid_t pid; pid_t pid;
} OpenFilesScreen; } OpenFilesScreen;
extern InfoScreenClass OpenFilesScreen_class; extern const InfoScreenClass OpenFilesScreen_class;
OpenFilesScreen* OpenFilesScreen_new(Process* process); OpenFilesScreen* OpenFilesScreen_new(Process* process);

View File

@ -19,7 +19,7 @@ in the source distribution for its full text.
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
PanelClass Panel_class = { const PanelClass Panel_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.delete = Panel_delete .delete = Panel_delete

View File

@ -60,7 +60,7 @@ struct Panel_ {
#define KEY_CTRL(l) ((l)-'A'+1) #define KEY_CTRL(l) ((l)-'A'+1)
extern PanelClass Panel_class; extern const PanelClass Panel_class;
Panel* Panel_new(int x, int y, int w, int h, bool owner, const ObjectClass* type, FunctionBar* fuBar); Panel* Panel_new(int x, int y, int w, int h, bool owner, const ObjectClass* type, FunctionBar* fuBar);

View File

@ -384,7 +384,7 @@ void Process_done(Process* this) {
free(this->comm); free(this->comm);
} }
ProcessClass Process_class = { const ProcessClass Process_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.display = Process_display, .display = Process_display,

View File

@ -162,7 +162,7 @@ void Process_display(Object* cast, RichString* out);
void Process_done(Process* this); void Process_done(Process* this);
extern ProcessClass Process_class; extern const ProcessClass Process_class;
void Process_init(Process* this, struct Settings_* settings); void Process_init(Process* this, struct Settings_* settings);

View File

@ -45,7 +45,7 @@ static void SwapMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_VALUE], buffer); RichString_append(out, CRT_colors[METER_VALUE], buffer);
} }
MeterClass SwapMeter_class = { const MeterClass SwapMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass SwapMeter_class; extern const MeterClass SwapMeter_class;
#endif #endif

View File

@ -66,7 +66,7 @@ static void TasksMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_TEXT], " running"); RichString_append(out, CRT_colors[METER_TEXT], " running");
} }
MeterClass TasksMeter_class = { const MeterClass TasksMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete, .delete = Meter_delete,

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass TasksMeter_class; extern const MeterClass TasksMeter_class;
#endif #endif

View File

@ -33,7 +33,7 @@ static const char* const TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"};
static int TraceScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27}; static int TraceScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27};
InfoScreenClass TraceScreen_class = { const InfoScreenClass TraceScreen_class = {
.super = { .super = {
.extends = Class(Object), .extends = Class(Object),
.delete = TraceScreen_delete .delete = TraceScreen_delete

View File

@ -21,7 +21,7 @@ typedef struct TraceScreen_ {
} TraceScreen; } TraceScreen;
extern InfoScreenClass TraceScreen_class; extern const InfoScreenClass TraceScreen_class;
TraceScreen* TraceScreen_new(Process* process); TraceScreen* TraceScreen_new(Process* process);

View File

@ -41,7 +41,7 @@ static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) {
xSnprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds); xSnprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds);
} }
MeterClass UptimeMeter_class = { const MeterClass UptimeMeter_class = {
.super = { .super = {
.extends = Class(Meter), .extends = Class(Meter),
.delete = Meter_delete .delete = Meter_delete

View File

@ -9,6 +9,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
extern MeterClass UptimeMeter_class; extern const MeterClass UptimeMeter_class;
#endif #endif

View File

@ -94,7 +94,7 @@ ProcessFieldData Process_fields[] = {
[100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, [100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
}; };
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -22,7 +22,7 @@ extern const unsigned int Platform_numberOfSignals;
extern ProcessFieldData Process_fields[]; extern ProcessFieldData Process_fields[];
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);

View File

@ -77,7 +77,7 @@ void Platform_setBindings(Htop_Action* keys) {
(void) keys; (void) keys;
} }
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -24,7 +24,7 @@ extern const unsigned int Platform_numberOfSignals;
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
int Platform_getUptime(void); int Platform_getUptime(void);

View File

@ -78,7 +78,7 @@ void Platform_setBindings(Htop_Action* keys) {
(void) keys; (void) keys;
} }
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -23,7 +23,7 @@ extern const unsigned int Platform_numberOfSignals;
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
int Platform_getUptime(void); int Platform_getUptime(void);

View File

@ -105,7 +105,7 @@ void Platform_setBindings(Htop_Action* keys) {
keys['i'] = Platform_actionSetIOPriority; keys['i'] = Platform_actionSetIOPriority;
} }
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -23,7 +23,7 @@ extern const unsigned int Platform_numberOfSignals;
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
int Platform_getUptime(void); int Platform_getUptime(void);

View File

@ -90,7 +90,7 @@ void Platform_setBindings(Htop_Action* keys) {
(void) keys; (void) keys;
} }
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -25,7 +25,7 @@ extern const unsigned int Platform_numberOfSignals;
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
int Platform_getUptime(void); int Platform_getUptime(void);

View File

@ -87,7 +87,7 @@ const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(Si
ProcessField Platform_defaultFields[] = { PID, LWPID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; ProcessField Platform_defaultFields[] = { PID, LWPID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -37,7 +37,7 @@ extern const unsigned int Platform_numberOfSignals;
extern ProcessField Platform_defaultFields[]; extern ProcessField Platform_defaultFields[];
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);

View File

@ -58,7 +58,7 @@ ProcessFieldData Process_fields[] = {
[100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, [100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
}; };
MeterClass* Platform_meterTypes[] = { const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class, &CPUMeter_class,
&ClockMeter_class, &ClockMeter_class,
&DateMeter_class, &DateMeter_class,

View File

@ -21,7 +21,7 @@ extern ProcessField Platform_defaultFields[];
extern ProcessFieldData Process_fields[]; extern ProcessFieldData Process_fields[];
extern MeterClass* Platform_meterTypes[]; extern const MeterClass* const Platform_meterTypes[];
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);