mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Introduce METER_BUFFER_CHECK and METER_BUFFER_APPEND_CHR to cleanup writing to bar buffers
Closes: #294
This commit is contained in:

committed by
Benny Baumann

parent
77ec86aff4
commit
ad764ff972
11
SwapMeter.c
11
SwapMeter.c
@ -22,12 +22,11 @@ static void SwapMeter_updateValues(Meter* this, char* buffer, size_t size) {
|
||||
Platform_setSwapValues(this);
|
||||
|
||||
written = Meter_humanUnit(buffer, this->values[0], size);
|
||||
buffer += written;
|
||||
if ((size -= written) > 0) {
|
||||
*buffer++ = '/';
|
||||
size--;
|
||||
Meter_humanUnit(buffer, this->total, size);
|
||||
}
|
||||
METER_BUFFER_CHECK(buffer, size, written);
|
||||
|
||||
METER_BUFFER_APPEND_CHR(buffer, size, '/');
|
||||
|
||||
Meter_humanUnit(buffer, this->total, size);
|
||||
}
|
||||
|
||||
static void SwapMeter_display(const Object* cast, RichString* out) {
|
||||
|
Reference in New Issue
Block a user