Mark several non-modified pointer variables const

This commit is contained in:
Christian Göttsche 2021-01-11 23:46:06 +01:00
parent 960f52b783
commit 2b62126aea
4 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ static void AvailableMetersPanel_delete(Object* object) {
} }
static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, const 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); const 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);
MetersPanel_setMoving((MetersPanel*)panel, true); MetersPanel_setMoving((MetersPanel*)panel, true);

View File

@ -216,7 +216,7 @@ MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* met
this->leftNeighbor = NULL; this->leftNeighbor = NULL;
Panel_setHeader(super, header); Panel_setHeader(super, header);
for (int i = 0; i < Vector_size(meters); i++) { for (int i = 0; i < Vector_size(meters); i++) {
Meter* meter = (Meter*) Vector_get(meters, i); const Meter* meter = (const Meter*) Vector_get(meters, i);
Panel_add(super, (Object*) Meter_toListItem(meter, false)); Panel_add(super, (Object*) Meter_toListItem(meter, false));
} }
return this; return this;

2
htop.c
View File

@ -215,7 +215,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
assert(optarg); /* please clang analyzer, cause optarg can be NULL in the 'u' case */ assert(optarg); /* please clang analyzer, cause optarg can be NULL in the 'u' case */
char* argCopy = xStrdup(optarg); char* argCopy = xStrdup(optarg);
char* saveptr; char* saveptr;
char* pid = strtok_r(argCopy, ",", &saveptr); const char* pid = strtok_r(argCopy, ",", &saveptr);
if(!flags.pidMatchList) { if(!flags.pidMatchList) {
flags.pidMatchList = Hashtable_new(8, false); flags.pidMatchList = Hashtable_new(8, false);

View File

@ -754,7 +754,7 @@ static void Platform_Battery_getSysData(double* percent, ACPresence* isOnAC) {
} }
char* buf = buffer; char* buf = buffer;
char* line = NULL; const char* line;
bool full = false; bool full = false;
bool now = false; bool now = false;
int fullSize = 0; int fullSize = 0;