summaryrefslogtreecommitdiffstats
path: root/SwapMeter.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-12-07 11:41:22 +1100
committerNathan Scott <nathans@redhat.com>2020-12-07 11:41:22 +1100
commitb92cfa7d7ac09b4e8a3c377496edd49228221f72 (patch)
treeaefa244b8140e21e2d02018e57c7b9fa0c7d23ec /SwapMeter.c
parent57d9ecc5519a44d4d08f1739ab4b741ccfc2d35a (diff)
parentad764ff972082608604634c84e5427e7bfdcda1a (diff)
Merge branch 'conversion' of https://github.com/cgzones/htop into cgzones-conversion
Diffstat (limited to 'SwapMeter.c')
-rw-r--r--SwapMeter.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/SwapMeter.c b/SwapMeter.c
index 9de7fa35..8e39c752 100644
--- a/SwapMeter.c
+++ b/SwapMeter.c
@@ -17,17 +17,16 @@ static const int SwapMeter_attributes[] = {
SWAP
};
-static void SwapMeter_updateValues(Meter* this, char* buffer, int size) {
+static void SwapMeter_updateValues(Meter* this, char* buffer, size_t size) {
int written;
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) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy