diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-03-07 15:31:41 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2021-03-17 15:54:17 +0100 |
commit | 1e806f9899600256cbcc540715261f461e11dd25 (patch) | |
tree | 292ef9c567e8a0c2b17758f25eab49120aebfcc1 /Meter.c | |
parent | d9f2eacbc5b3fccf63b24944ce9a30d762baea3c (diff) |
RichString: do not unnecessarily clean whole buffer
The local stack buffer does not need to be cleaned to zeros when
- just initialized, cause the length is set to 0 and the first
character is set to '\0', so all printing functions will safely stop
- no further used, i.e. the variable goes out of scope
Diffstat (limited to 'Meter.c')
-rw-r--r-- | Meter.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -167,7 +167,7 @@ static void TextMeterMode_draw(Meter* this, int x, int y, ATTR_UNUSED int w) { RichString_begin(out); Meter_displayBuffer(this, &out); RichString_printoffnVal(out, y, x, 0, w - 1); - RichString_end(out); + RichString_delete(&out); } /* ---------- BarMeterMode ---------- */ @@ -257,7 +257,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { RichString_printoffnVal(bar, y, x + offset, startPos + offset, w - offset); } - RichString_end(bar); + RichString_delete(&bar); move(y, x + w + 1); attrset(CRT_colors[RESET_COLOR]); @@ -414,7 +414,7 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, ATTR_UNUSED int w) { } } attrset(CRT_colors[RESET_COLOR]); - RichString_end(out); + RichString_delete(&out); } static MeterMode BarMeterMode = { @@ -456,8 +456,7 @@ static void BlankMeter_updateValues(Meter* this) { this->txtBuffer[0] = '\0'; } -static void BlankMeter_display(ATTR_UNUSED const Object* cast, RichString* out) { - RichString_prune(out); +static void BlankMeter_display(ATTR_UNUSED const Object* cast, ATTR_UNUSED RichString* out) { } static const int BlankMeter_attributes[] = { |