mirror of https://github.com/xzeldon/htop.git
Mark Object instances const
This commit is contained in:
parent
08d85e6143
commit
ba282cfe19
|
@ -319,7 +319,7 @@ static MaskItem *AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t ob
|
|||
|
||||
#endif
|
||||
|
||||
PanelClass AffinityPanel_class = {
|
||||
const PanelClass AffinityPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = AffinityPanel_delete
|
||||
|
|
|
@ -11,7 +11,7 @@ in the source distribution for its full text.
|
|||
#include "Affinity.h"
|
||||
#include "ProcessList.h"
|
||||
|
||||
extern PanelClass AffinityPanel_class;
|
||||
extern const PanelClass AffinityPanel_class;
|
||||
|
||||
Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity, int* width);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass AvailableColumnsPanel_class = {
|
||||
const PanelClass AvailableColumnsPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = AvailableColumnsPanel_delete
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef struct AvailableColumnsPanel_ {
|
|||
Panel* columns;
|
||||
} AvailableColumnsPanel;
|
||||
|
||||
extern PanelClass AvailableColumnsPanel_class;
|
||||
extern const PanelClass AvailableColumnsPanel_class;
|
||||
|
||||
AvailableColumnsPanel* AvailableColumnsPanel_new(Panel* columns);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static void AvailableMetersPanel_delete(Object* object) {
|
|||
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);
|
||||
Panel_add(panel, (Object*) Meter_toListItem(meter, false));
|
||||
Panel_setSelected(panel, Panel_size(panel) - 1);
|
||||
|
@ -77,7 +77,7 @@ static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass AvailableMetersPanel_class = {
|
||||
const PanelClass AvailableMetersPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.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
|
||||
// handle separately in the code below.
|
||||
for (int i = 1; Platform_meterTypes[i]; i++) {
|
||||
MeterClass* type = Platform_meterTypes[i];
|
||||
const MeterClass* type = Platform_meterTypes[i];
|
||||
assert(type != &CPUMeter_class);
|
||||
const char* label = type->description ? type->description : type->uiName;
|
||||
Panel_add(super, (Object*) ListItem_new(label, i << 16));
|
||||
}
|
||||
// Handle (&CPUMeter_class)
|
||||
MeterClass* type = &CPUMeter_class;
|
||||
const MeterClass* type = &CPUMeter_class;
|
||||
int cpus = pl->cpuCount;
|
||||
if (cpus > 1) {
|
||||
Panel_add(super, (Object*) ListItem_new("CPU average", 0));
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef struct AvailableMetersPanel_ {
|
|||
Panel* rightPanel;
|
||||
} 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);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) {
|
|||
}
|
||||
}
|
||||
|
||||
MeterClass BatteryMeter_class = {
|
||||
const MeterClass BatteryMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -17,6 +17,6 @@ typedef enum ACPresence_ {
|
|||
AC_ERROR
|
||||
} ACPresence;
|
||||
|
||||
extern MeterClass BatteryMeter_class;
|
||||
extern const MeterClass BatteryMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
26
CPUMeter.c
26
CPUMeter.c
|
@ -246,7 +246,7 @@ static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) {
|
|||
}
|
||||
|
||||
|
||||
MeterClass CPUMeter_class = {
|
||||
const MeterClass CPUMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -263,7 +263,7 @@ MeterClass CPUMeter_class = {
|
|||
.init = CPUMeter_init
|
||||
};
|
||||
|
||||
MeterClass AllCPUsMeter_class = {
|
||||
const MeterClass AllCPUsMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -282,7 +282,7 @@ MeterClass AllCPUsMeter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass AllCPUs2Meter_class = {
|
||||
const MeterClass AllCPUs2Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -301,7 +301,7 @@ MeterClass AllCPUs2Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass LeftCPUsMeter_class = {
|
||||
const MeterClass LeftCPUsMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -320,7 +320,7 @@ MeterClass LeftCPUsMeter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass RightCPUsMeter_class = {
|
||||
const MeterClass RightCPUsMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -339,7 +339,7 @@ MeterClass RightCPUsMeter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass LeftCPUs2Meter_class = {
|
||||
const MeterClass LeftCPUs2Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -358,7 +358,7 @@ MeterClass LeftCPUs2Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass RightCPUs2Meter_class = {
|
||||
const MeterClass RightCPUs2Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -377,7 +377,7 @@ MeterClass RightCPUs2Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass AllCPUs4Meter_class = {
|
||||
const MeterClass AllCPUs4Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -396,7 +396,7 @@ MeterClass AllCPUs4Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass LeftCPUs4Meter_class = {
|
||||
const MeterClass LeftCPUs4Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -415,7 +415,7 @@ MeterClass LeftCPUs4Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass RightCPUs4Meter_class = {
|
||||
const MeterClass RightCPUs4Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -434,7 +434,7 @@ MeterClass RightCPUs4Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass AllCPUs8Meter_class = {
|
||||
const MeterClass AllCPUs8Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -453,7 +453,7 @@ MeterClass AllCPUs8Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass LeftCPUs8Meter_class = {
|
||||
const MeterClass LeftCPUs8Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -472,7 +472,7 @@ MeterClass LeftCPUs8Meter_class = {
|
|||
.done = AllCPUsMeter_done
|
||||
};
|
||||
|
||||
MeterClass RightCPUs8Meter_class = {
|
||||
const MeterClass RightCPUs8Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
26
CPUMeter.h
26
CPUMeter.h
|
@ -22,30 +22,30 @@ typedef enum {
|
|||
CPU_METER_ITEMCOUNT = 9, // number of entries in this enum
|
||||
} 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
|
||||
|
|
|
@ -109,7 +109,7 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass CategoriesPanel_class = {
|
||||
const PanelClass CategoriesPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = CategoriesPanel_delete
|
||||
|
|
|
@ -23,7 +23,7 @@ typedef struct CategoriesPanel_ {
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static void CheckItem_display(Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
|
||||
}
|
||||
|
||||
ObjectClass CheckItem_class = {
|
||||
const ObjectClass CheckItem_class = {
|
||||
.display = CheckItem_display,
|
||||
.delete = CheckItem_delete
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct CheckItem_ {
|
|||
bool value;
|
||||
} CheckItem;
|
||||
|
||||
extern ObjectClass CheckItem_class;
|
||||
extern const ObjectClass CheckItem_class;
|
||||
|
||||
CheckItem* CheckItem_newByRef(char* text, bool* ref);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static void ClockMeter_updateValues(Meter* this, char* buffer, int size) {
|
|||
strftime(buffer, size, "%H:%M:%S", lt);
|
||||
}
|
||||
|
||||
MeterClass ClockMeter_class = {
|
||||
const MeterClass ClockMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass ClockMeter_class;
|
||||
extern const MeterClass ClockMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass ColorsPanel_class = {
|
||||
const PanelClass ColorsPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = ColorsPanel_delete
|
||||
|
|
|
@ -18,7 +18,7 @@ typedef struct ColorsPanel_ {
|
|||
ScreenManager* scr;
|
||||
} ColorsPanel;
|
||||
|
||||
extern PanelClass ColorsPanel_class;
|
||||
extern const PanelClass ColorsPanel_class;
|
||||
|
||||
ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr);
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass ColumnsPanel_class = {
|
||||
const PanelClass ColumnsPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = ColumnsPanel_delete
|
||||
|
|
|
@ -17,7 +17,7 @@ typedef struct ColumnsPanel_ {
|
|||
bool moving;
|
||||
} ColumnsPanel;
|
||||
|
||||
extern PanelClass ColumnsPanel_class;
|
||||
extern const PanelClass ColumnsPanel_class;
|
||||
|
||||
ColumnsPanel* ColumnsPanel_new(Settings* settings);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static void CommandScreen_draw(InfoScreen* this) {
|
|||
InfoScreen_drawTitled(this, "Command of process %d - %s", this->process->pid, this->process->comm);
|
||||
}
|
||||
|
||||
InfoScreenClass CommandScreen_class = {
|
||||
const InfoScreenClass CommandScreen_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.delete = CommandScreen_delete
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct CommandScreen_ {
|
|||
InfoScreen super;
|
||||
} CommandScreen;
|
||||
|
||||
extern InfoScreenClass CommandScreen_class;
|
||||
extern const InfoScreenClass CommandScreen_class;
|
||||
|
||||
CommandScreen* CommandScreen_new(Process* process);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static void DateMeter_updateValues(Meter* this, char* buffer, int size) {
|
|||
strftime(buffer, size, "%F", lt);
|
||||
}
|
||||
|
||||
MeterClass DateMeter_class = {
|
||||
const MeterClass DateMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass DateMeter_class;
|
||||
extern const MeterClass DateMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ static void DateTimeMeter_updateValues(Meter* this, char* buffer, int size) {
|
|||
strftime(buffer, size, "%F %H:%M:%S", lt);
|
||||
}
|
||||
|
||||
MeterClass DateTimeMeter_class = {
|
||||
const MeterClass DateTimeMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass DateTimeMeter_class;
|
||||
extern const MeterClass DateTimeMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,7 @@ static void DIskIOMeter_display(ATTR_UNUSED Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[DISKIO_WRITE], buffer);
|
||||
}
|
||||
|
||||
MeterClass DiskIOMeter_class = {
|
||||
const MeterClass DiskIOMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass DiskIOMeter_class;
|
||||
extern const MeterClass DiskIOMeter_class;
|
||||
|
||||
#endif /* HEADER_DiskIOMeter */
|
||||
|
|
|
@ -52,7 +52,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass DisplayOptionsPanel_class = {
|
||||
const PanelClass DisplayOptionsPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = DisplayOptionsPanel_delete
|
||||
|
|
|
@ -18,7 +18,7 @@ typedef struct DisplayOptionsPanel_ {
|
|||
ScreenManager* scr;
|
||||
} DisplayOptionsPanel;
|
||||
|
||||
extern PanelClass DisplayOptionsPanel_class;
|
||||
extern const PanelClass DisplayOptionsPanel_class;
|
||||
|
||||
DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
|
||||
InfoScreenClass EnvScreen_class = {
|
||||
const InfoScreenClass EnvScreen_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.delete = EnvScreen_delete
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct EnvScreen_ {
|
|||
InfoScreen super;
|
||||
} EnvScreen;
|
||||
|
||||
extern InfoScreenClass EnvScreen_class;
|
||||
extern const InfoScreenClass EnvScreen_class;
|
||||
|
||||
EnvScreen* EnvScreen_new(Process* process);
|
||||
|
||||
|
|
4
Header.c
4
Header.c
|
@ -88,7 +88,7 @@ MeterModeId Header_addMeterByName(Header* this, char* name, int column) {
|
|||
*paren = '\0';
|
||||
}
|
||||
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)) {
|
||||
Meter* meter = Meter_new(this->pl, param, *type);
|
||||
Vector_add(meters, meter);
|
||||
|
@ -110,7 +110,7 @@ void Header_setMode(Header* this, int i, MeterModeId mode, int column) {
|
|||
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];
|
||||
|
||||
Meter* meter = Meter_new(this->pl, param, type);
|
||||
|
|
2
Header.h
2
Header.h
|
@ -34,7 +34,7 @@ MeterModeId Header_addMeterByName(Header* this, char* name, 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);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static void HostnameMeter_updateValues(Meter* this, char* buffer, int size) {
|
|||
gethostname(buffer, size-1);
|
||||
}
|
||||
|
||||
MeterClass HostnameMeter_class = {
|
||||
const MeterClass HostnameMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass HostnameMeter_class;
|
||||
extern const MeterClass HostnameMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ static void ListItem_display(Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[DEFAULT_COLOR], this->value/*buffer*/);
|
||||
}
|
||||
|
||||
ObjectClass ListItem_class = {
|
||||
const ObjectClass ListItem_class = {
|
||||
.display = ListItem_display,
|
||||
.delete = ListItem_delete,
|
||||
.compare = ListItem_compare
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct ListItem_ {
|
|||
bool moving;
|
||||
} ListItem;
|
||||
|
||||
extern ObjectClass ListItem_class;
|
||||
extern const ObjectClass ListItem_class;
|
||||
|
||||
ListItem* ListItem_new(const char* value, int key);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ static void LoadMeter_display(Object* cast, RichString* out) {
|
|||
RichString_write(out, CRT_colors[LOAD], buffer);
|
||||
}
|
||||
|
||||
MeterClass LoadAverageMeter_class = {
|
||||
const MeterClass LoadAverageMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
@ -70,7 +70,7 @@ MeterClass LoadAverageMeter_class = {
|
|||
.caption = "Load average: "
|
||||
};
|
||||
|
||||
MeterClass LoadMeter_class = {
|
||||
const MeterClass LoadMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
|
@ -9,8 +9,8 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass LoadAverageMeter_class;
|
||||
extern const MeterClass LoadAverageMeter_class;
|
||||
|
||||
extern MeterClass LoadMeter_class;
|
||||
extern const MeterClass LoadMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,7 +150,7 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar
|
|||
return ok;
|
||||
}
|
||||
|
||||
PanelClass MainPanel_class = {
|
||||
const PanelClass MainPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = MainPanel_delete
|
||||
|
|
|
@ -34,7 +34,7 @@ const char* MainPanel_getValue(MainPanel* this, int i);
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ static void MemoryMeter_display(Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);
|
||||
}
|
||||
|
||||
MeterClass MemoryMeter_class = {
|
||||
const MeterClass MemoryMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass MemoryMeter_class;
|
||||
extern const MeterClass MemoryMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
8
Meter.c
8
Meter.c
|
@ -21,7 +21,7 @@ in the source distribution for its full text.
|
|||
|
||||
#define GRAPH_HEIGHT 4 /* Unit: rows (lines) */
|
||||
|
||||
MeterClass Meter_class = {
|
||||
const MeterClass Meter_class = {
|
||||
.super = {
|
||||
.extends = Class(Object)
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void Meter_setMode(Meter* this, int modeIndex) {
|
|||
free(this->drawData);
|
||||
this->drawData = NULL;
|
||||
|
||||
MeterMode* mode = Meter_modes[modeIndex];
|
||||
const MeterMode* mode = Meter_modes[modeIndex];
|
||||
this->draw = mode->draw;
|
||||
this->h = mode->h;
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ static MeterMode LEDMeterMode = {
|
|||
.draw = LEDMeterMode_draw,
|
||||
};
|
||||
|
||||
MeterMode* Meter_modes[] = {
|
||||
const MeterMode* const Meter_modes[] = {
|
||||
NULL,
|
||||
&BarMeterMode,
|
||||
&TextMeterMode,
|
||||
|
@ -437,7 +437,7 @@ static const int BlankMeter_attributes[] = {
|
|||
DEFAULT_COLOR
|
||||
};
|
||||
|
||||
MeterClass BlankMeter_class = {
|
||||
const MeterClass BlankMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
6
Meter.h
6
Meter.h
|
@ -88,7 +88,7 @@ typedef struct GraphData_ {
|
|||
double values[METER_BUFFER_LEN];
|
||||
} GraphData;
|
||||
|
||||
extern MeterClass Meter_class;
|
||||
extern const MeterClass Meter_class;
|
||||
|
||||
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);
|
||||
|
||||
extern MeterMode* Meter_modes[];
|
||||
extern const MeterMode* const Meter_modes[];
|
||||
|
||||
extern MeterClass BlankMeter_class;
|
||||
extern const MeterClass BlankMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -186,7 +186,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PanelClass MetersPanel_class = {
|
||||
const PanelClass MetersPanel_class = {
|
||||
.super = {
|
||||
.extends = Class(Panel),
|
||||
.delete = MetersPanel_delete
|
||||
|
|
|
@ -28,7 +28,7 @@ void MetersPanel_cleanup(void);
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ in the source distribution for its full text.
|
|||
#include <sys/wait.h>
|
||||
|
||||
|
||||
InfoScreenClass OpenFilesScreen_class = {
|
||||
const InfoScreenClass OpenFilesScreen_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.delete = OpenFilesScreen_delete
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct OpenFilesScreen_ {
|
|||
pid_t pid;
|
||||
} OpenFilesScreen;
|
||||
|
||||
extern InfoScreenClass OpenFilesScreen_class;
|
||||
extern const InfoScreenClass OpenFilesScreen_class;
|
||||
|
||||
OpenFilesScreen* OpenFilesScreen_new(Process* process);
|
||||
|
||||
|
|
2
Panel.c
2
Panel.c
|
@ -19,7 +19,7 @@ in the source distribution for its full text.
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
PanelClass Panel_class = {
|
||||
const PanelClass Panel_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.delete = Panel_delete
|
||||
|
|
2
Panel.h
2
Panel.h
|
@ -60,7 +60,7 @@ struct Panel_ {
|
|||
|
||||
#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);
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ void Process_done(Process* this) {
|
|||
free(this->comm);
|
||||
}
|
||||
|
||||
ProcessClass Process_class = {
|
||||
const ProcessClass Process_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.display = Process_display,
|
||||
|
|
|
@ -162,7 +162,7 @@ void Process_display(Object* cast, RichString* out);
|
|||
|
||||
void Process_done(Process* this);
|
||||
|
||||
extern ProcessClass Process_class;
|
||||
extern const ProcessClass Process_class;
|
||||
|
||||
void Process_init(Process* this, struct Settings_* settings);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static void SwapMeter_display(Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[METER_VALUE], buffer);
|
||||
}
|
||||
|
||||
MeterClass SwapMeter_class = {
|
||||
const MeterClass SwapMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass SwapMeter_class;
|
||||
extern const MeterClass SwapMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,7 +66,7 @@ static void TasksMeter_display(Object* cast, RichString* out) {
|
|||
RichString_append(out, CRT_colors[METER_TEXT], " running");
|
||||
}
|
||||
|
||||
MeterClass TasksMeter_class = {
|
||||
const MeterClass TasksMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete,
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass TasksMeter_class;
|
||||
extern const MeterClass TasksMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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};
|
||||
|
||||
InfoScreenClass TraceScreen_class = {
|
||||
const InfoScreenClass TraceScreen_class = {
|
||||
.super = {
|
||||
.extends = Class(Object),
|
||||
.delete = TraceScreen_delete
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef struct TraceScreen_ {
|
|||
} TraceScreen;
|
||||
|
||||
|
||||
extern InfoScreenClass TraceScreen_class;
|
||||
extern const InfoScreenClass TraceScreen_class;
|
||||
|
||||
TraceScreen* TraceScreen_new(Process* process);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
MeterClass UptimeMeter_class = {
|
||||
const MeterClass UptimeMeter_class = {
|
||||
.super = {
|
||||
.extends = Class(Meter),
|
||||
.delete = Meter_delete
|
||||
|
|
|
@ -9,6 +9,6 @@ in the source distribution for its full text.
|
|||
|
||||
#include "Meter.h"
|
||||
|
||||
extern MeterClass UptimeMeter_class;
|
||||
extern const MeterClass UptimeMeter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -94,7 +94,7 @@ ProcessFieldData Process_fields[] = {
|
|||
[100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
|
||||
};
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -22,7 +22,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
extern ProcessFieldData Process_fields[];
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void Platform_setBindings(Htop_Action* keys) {
|
|||
(void) keys;
|
||||
}
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -24,7 +24,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
int Platform_getUptime(void);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void Platform_setBindings(Htop_Action* keys) {
|
|||
(void) keys;
|
||||
}
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -23,7 +23,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
int Platform_getUptime(void);
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void Platform_setBindings(Htop_Action* keys) {
|
|||
keys['i'] = Platform_actionSetIOPriority;
|
||||
}
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -23,7 +23,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
int Platform_getUptime(void);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void Platform_setBindings(Htop_Action* keys) {
|
|||
(void) keys;
|
||||
}
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -25,7 +25,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
int Platform_getUptime(void);
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -37,7 +37,7 @@ extern const unsigned int Platform_numberOfSignals;
|
|||
|
||||
extern ProcessField Platform_defaultFields[];
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ ProcessFieldData Process_fields[] = {
|
|||
[100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
|
||||
};
|
||||
|
||||
MeterClass* Platform_meterTypes[] = {
|
||||
const MeterClass* const Platform_meterTypes[] = {
|
||||
&CPUMeter_class,
|
||||
&ClockMeter_class,
|
||||
&DateMeter_class,
|
||||
|
|
|
@ -21,7 +21,7 @@ extern ProcessField Platform_defaultFields[];
|
|||
|
||||
extern ProcessFieldData Process_fields[];
|
||||
|
||||
extern MeterClass* Platform_meterTypes[];
|
||||
extern const MeterClass* const Platform_meterTypes[];
|
||||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
|
|
Loading…
Reference in New Issue