Use sizeof buffer instead of magic number

This commit is contained in:
Christian Göttsche
2020-12-08 16:36:00 +01:00
parent c6d9fa279b
commit 5506925b34
4 changed files with 16 additions and 16 deletions

View File

@ -35,15 +35,15 @@ static void MemoryMeter_display(const Object* cast, RichString* out) {
char buffer[50];
const Meter* this = (const Meter*)cast;
RichString_write(out, CRT_colors[METER_TEXT], ":");
Meter_humanUnit(buffer, this->total, 50);
Meter_humanUnit(buffer, this->total, sizeof(buffer));
RichString_append(out, CRT_colors[METER_VALUE], buffer);
Meter_humanUnit(buffer, this->values[0], 50);
Meter_humanUnit(buffer, this->values[0], sizeof(buffer));
RichString_append(out, CRT_colors[METER_TEXT], " used:");
RichString_append(out, CRT_colors[MEMORY_USED], buffer);
Meter_humanUnit(buffer, this->values[1], 50);
Meter_humanUnit(buffer, this->values[1], sizeof(buffer));
RichString_append(out, CRT_colors[METER_TEXT], " buffers:");
RichString_append(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer);
Meter_humanUnit(buffer, this->values[2], 50);
Meter_humanUnit(buffer, this->values[2], sizeof(buffer));
RichString_append(out, CRT_colors[METER_TEXT], " cache:");
RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);
}