]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: use ascii_toupper() instead of everytime judging whether it is the first message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Oct 2018 00:19:24 +0000 (09:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 23 Oct 2018 19:58:08 +0000 (04:58 +0900)
src/core/unit.c

index 1336bcc33aa0e7edbea36e5e974464770372ee3e..c8f4c7ce0c3ff0359375cba9de3d9629538265c5 100644 (file)
@@ -2207,7 +2207,7 @@ static int unit_log_resources(Unit *u) {
 
                 /* Format the CPU time for inclusion in the human language message string */
                 format_timespan(buf, sizeof(buf), nsec / NSEC_PER_USEC, USEC_PER_MSEC);
-                t = strjoin(n_message_parts > 0 ? "consumed " : "Consumed ", buf, " CPU time");
+                t = strjoin("consumed ", buf, " CPU time");
                 if (!t) {
                         r = log_oom();
                         goto finish;
@@ -2239,18 +2239,14 @@ static int unit_log_resources(Unit *u) {
                  * bytes counters (and not for the packets counters) */
                 if (m == CGROUP_IP_INGRESS_BYTES) {
                         assert(!igress);
-                        igress = strjoin(n_message_parts > 0 ? "received " : "Received ",
-                                         format_bytes(buf, sizeof(buf), value),
-                                         " IP traffic");
+                        igress = strjoin("received ", format_bytes(buf, sizeof(buf), value), " IP traffic");
                         if (!igress) {
                                 r = log_oom();
                                 goto finish;
                         }
                 } else if (m == CGROUP_IP_EGRESS_BYTES) {
                         assert(!egress);
-                        egress = strjoin(igress || n_message_parts > 0 ? "sent " : "Sent ",
-                                         format_bytes(buf, sizeof(buf), value),
-                                         " IP traffic");
+                        egress = strjoin("sent ", format_bytes(buf, sizeof(buf), value), " IP traffic");
                         if (!egress) {
                                 r = log_oom();
                                 goto finish;
@@ -2266,7 +2262,7 @@ static int unit_log_resources(Unit *u) {
         } else {
                 char *k;
 
-                k = strdup(n_message_parts > 0 ? "no IP traffic" : "No IP traffic");
+                k = strdup("no IP traffic");
                 if (!k) {
                         r = log_oom();
                         goto finish;
@@ -2294,6 +2290,7 @@ static int unit_log_resources(Unit *u) {
                         goto finish;
                 }
 
+                joined[0] = ascii_toupper(joined[0]);
                 t = strjoina("MESSAGE=", u->id, ": ", joined, ".");
         }