Skip to content

Commit

Permalink
Mark Object instances const
Browse files Browse the repository at this point in the history
  • Loading branch information
cgzones committed Oct 7, 2020
1 parent 08d85e6 commit ba282cf
Show file tree
Hide file tree
Showing 76 changed files with 111 additions and 111 deletions.
2 changes: 1 addition & 1 deletion AffinityPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AffinityPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion AvailableColumnsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AvailableColumnsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ typedef struct AvailableColumnsPanel_ {
Panel* columns;
} AvailableColumnsPanel;

extern PanelClass AvailableColumnsPanel_class;
extern const PanelClass AvailableColumnsPanel_class;

AvailableColumnsPanel* AvailableColumnsPanel_new(Panel* columns);

Expand Down
8 changes: 4 additions & 4 deletions AvailableMetersPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion AvailableMetersPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion BatteryMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion BatteryMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ typedef enum ACPresence_ {
AC_ERROR
} ACPresence;

extern MeterClass BatteryMeter_class;
extern const MeterClass BatteryMeter_class;

#endif
26 changes: 13 additions & 13 deletions CPUMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -263,7 +263,7 @@ MeterClass CPUMeter_class = {
.init = CPUMeter_init
};

MeterClass AllCPUsMeter_class = {
const MeterClass AllCPUsMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -282,7 +282,7 @@ MeterClass AllCPUsMeter_class = {
.done = AllCPUsMeter_done
};

MeterClass AllCPUs2Meter_class = {
const MeterClass AllCPUs2Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -301,7 +301,7 @@ MeterClass AllCPUs2Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass LeftCPUsMeter_class = {
const MeterClass LeftCPUsMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -320,7 +320,7 @@ MeterClass LeftCPUsMeter_class = {
.done = AllCPUsMeter_done
};

MeterClass RightCPUsMeter_class = {
const MeterClass RightCPUsMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -339,7 +339,7 @@ MeterClass RightCPUsMeter_class = {
.done = AllCPUsMeter_done
};

MeterClass LeftCPUs2Meter_class = {
const MeterClass LeftCPUs2Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -358,7 +358,7 @@ MeterClass LeftCPUs2Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass RightCPUs2Meter_class = {
const MeterClass RightCPUs2Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -377,7 +377,7 @@ MeterClass RightCPUs2Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass AllCPUs4Meter_class = {
const MeterClass AllCPUs4Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -396,7 +396,7 @@ MeterClass AllCPUs4Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass LeftCPUs4Meter_class = {
const MeterClass LeftCPUs4Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -415,7 +415,7 @@ MeterClass LeftCPUs4Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass RightCPUs4Meter_class = {
const MeterClass RightCPUs4Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -434,7 +434,7 @@ MeterClass RightCPUs4Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass AllCPUs8Meter_class = {
const MeterClass AllCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -453,7 +453,7 @@ MeterClass AllCPUs8Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass LeftCPUs8Meter_class = {
const MeterClass LeftCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand All @@ -472,7 +472,7 @@ MeterClass LeftCPUs8Meter_class = {
.done = AllCPUsMeter_done
};

MeterClass RightCPUs8Meter_class = {
const MeterClass RightCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
Expand Down
26 changes: 13 additions & 13 deletions CPUMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CategoriesPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CategoriesPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion CheckItem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion CheckItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ClockMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ClockMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ColorsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ColorsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ColumnsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ColumnsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct ColumnsPanel_ {
bool moving;
} ColumnsPanel;

extern PanelClass ColumnsPanel_class;
extern const PanelClass ColumnsPanel_class;

ColumnsPanel* ColumnsPanel_new(Settings* settings);

Expand Down
2 changes: 1 addition & 1 deletion CommandScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CommandScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ typedef struct CommandScreen_ {
InfoScreen super;
} CommandScreen;

extern InfoScreenClass CommandScreen_class;
extern const InfoScreenClass CommandScreen_class;

CommandScreen* CommandScreen_new(Process* process);

Expand Down
2 changes: 1 addition & 1 deletion DateMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DateMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion DateTimeMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DateTimeMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit ba282cf

Please sign in to comment.