summaryrefslogtreecommitdiffstats
path: root/linux/SystemdMeter.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-12-04 14:44:57 +0100
committerBenBE <BenBE@geshi.org>2020-12-08 20:58:40 +0100
commit157086e750187f6bceeea697d10bf58403c7d5de (patch)
tree82c6512c1a1e88c9ab9f77ca9bf1531da265e331 /linux/SystemdMeter.c
parent5506925b346b09f8556ce2c8f83fe3d69dc1c03c (diff)
Split RichString_(append|appendn|write) into wide and ascii
RichString_writeFrom takes a top spot during performance analysis due to the calls to mbstowcs() and iswprint(). Most of the time we know in advance that we are only going to print regular ASCII characters.
Diffstat (limited to 'linux/SystemdMeter.c')
-rw-r--r--linux/SystemdMeter.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/linux/SystemdMeter.c b/linux/SystemdMeter.c
index 4350d264..61bb59b3 100644
--- a/linux/SystemdMeter.c
+++ b/linux/SystemdMeter.c
@@ -267,9 +267,9 @@ static void SystemdMeter_display(ATTR_UNUSED const Object* cast, RichString* out
char buffer[16];
int color = (systemState && 0 == strcmp(systemState, "running")) ? METER_VALUE_OK : METER_VALUE_ERROR;
- RichString_write(out, CRT_colors[color], systemState ? systemState : "???");
+ RichString_writeAscii(out, CRT_colors[color], systemState ? systemState : "N/A");
- RichString_append(out, CRT_colors[METER_TEXT], " (");
+ RichString_appendAscii(out, CRT_colors[METER_TEXT], " (");
if (nFailedUnits == INVALID_VALUE) {
buffer[0] = '?';
@@ -277,9 +277,9 @@ static void SystemdMeter_display(ATTR_UNUSED const Object* cast, RichString* out
} else {
xSnprintf(buffer, sizeof(buffer), "%u", nFailedUnits);
}
- RichString_append(out, zeroDigitColor(nFailedUnits), buffer);
+ RichString_appendAscii(out, zeroDigitColor(nFailedUnits), buffer);
- RichString_append(out, CRT_colors[METER_TEXT], "/");
+ RichString_appendAscii(out, CRT_colors[METER_TEXT], "/");
if (nNames == INVALID_VALUE) {
buffer[0] = '?';
@@ -287,9 +287,9 @@ static void SystemdMeter_display(ATTR_UNUSED const Object* cast, RichString* out
} else {
xSnprintf(buffer, sizeof(buffer), "%u", nNames);
}
- RichString_append(out, valueDigitColor(nNames), buffer);
+ RichString_appendAscii(out, valueDigitColor(nNames), buffer);
- RichString_append(out, CRT_colors[METER_TEXT], " failed) (");
+ RichString_appendAscii(out, CRT_colors[METER_TEXT], " failed) (");
if (nJobs == INVALID_VALUE) {
buffer[0] = '?';
@@ -297,9 +297,9 @@ static void SystemdMeter_display(ATTR_UNUSED const Object* cast, RichString* out
} else {
xSnprintf(buffer, sizeof(buffer), "%u", nJobs);
}
- RichString_append(out, zeroDigitColor(nJobs), buffer);
+ RichString_appendAscii(out, zeroDigitColor(nJobs), buffer);
- RichString_append(out, CRT_colors[METER_TEXT], "/");
+ RichString_appendAscii(out, CRT_colors[METER_TEXT], "/");
if (nInstalledJobs == INVALID_VALUE) {
buffer[0] = '?';
@@ -307,9 +307,9 @@ static void SystemdMeter_display(ATTR_UNUSED const Object* cast, RichString* out
} else {
xSnprintf(buffer, sizeof(buffer), "%u", nInstalledJobs);
}
- RichString_append(out, valueDigitColor(nInstalledJobs), buffer);
+ RichString_appendAscii(out, valueDigitColor(nInstalledJobs), buffer);
- RichString_append(out, CRT_colors[METER_TEXT], " jobs)");
+ RichString_appendAscii(out, CRT_colors[METER_TEXT], " jobs)");
}
static const int SystemdMeter_attributes[] = {

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