diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-11-24 19:34:27 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2020-12-06 16:03:44 +0100 |
commit | ad764ff972082608604634c84e5427e7bfdcda1a (patch) | |
tree | 3b4cb72205d708563bd9baf62ef2039dc8bafdac /zfs | |
parent | 77ec86aff4314afd893baed0d16d7bd52c387fd4 (diff) |
Introduce METER_BUFFER_CHECK and METER_BUFFER_APPEND_CHR to cleanup writing to bar buffers
Closes: #294
Diffstat (limited to 'zfs')
-rw-r--r-- | zfs/ZfsArcMeter.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/zfs/ZfsArcMeter.c b/zfs/ZfsArcMeter.c index 5b8082bb..e844d779 100644 --- a/zfs/ZfsArcMeter.c +++ b/zfs/ZfsArcMeter.c @@ -38,12 +38,11 @@ static void ZfsArcMeter_updateValues(Meter* this, char* buffer, size_t size) { Platform_setZfsArcValues(this); written = Meter_humanUnit(buffer, this->values[5], 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 ZfsArcMeter_display(const Object* cast, RichString* out) { |