]> granicus.if.org Git - sysstat/commitdiff
Use strings definition whenever possible
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 12 Feb 2022 17:07:10 +0000 (18:07 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 12 Feb 2022 17:07:10 +0000 (18:07 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
ioconf.c
json_stats.c
mpstat.c
pr_stats.c
svg_stats.c
xml_stats.c

index 94af73566dfc62fb42adc7b125442621defc9639..ea2c578a199ac4362ee7b55d701da8fdadbe8f3d 100644 (file)
--- a/ioconf.c
+++ b/ioconf.c
@@ -119,7 +119,7 @@ static char *ioc_conv(int radix, int nozero, const char *syms,
 
 char *ioc_ito10(unsigned int n)
 {
-       return (ioc_conv(10, 0, "0123456789", n));
+       return (ioc_conv(10, 0, DIGITS, n));
 }
 
 char *ioc_ito26(unsigned int n)
index 5b989eaee9c6747cc1f0316e5382e3e866454e10..fe090d3b177233fe42eb9750e635a31b8c6659fc 100644 (file)
@@ -177,7 +177,7 @@ __print_funct_t json_print_cpu_stats(struct activity *a, int curr, int tab,
 
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
 
                        if (a->nr_ini == 1) {
                                /*
@@ -1847,7 +1847,7 @@ __print_funct_t json_print_pwr_cpufreq_stats(struct activity *a, int curr, int t
 
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);
@@ -2126,7 +2126,7 @@ __print_funct_t json_print_pwr_wghfreq_stats(struct activity *a, int curr, int t
 
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);
@@ -2432,7 +2432,7 @@ __print_funct_t json_print_softnet_stats(struct activity *a, int curr, int tab,
 
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);
index a63eb059ffa10d9356e505f4a1e81aa43795f48a..3f6944d46e87769b235d0d922f43897ec2b7131e 100644 (file)
--- a/mpstat.c
+++ b/mpstat.c
@@ -792,7 +792,7 @@ void write_json_cpu_stats(int tab, unsigned long long deltot_jiffies, int prev,
 
                if (i == 0) {
                        /* This is CPU "all" */
-                       strcpy(cpu_name, "all");
+                       strcpy(cpu_name, K_LOWERALL);
 
                        if (DISPLAY_TOPOLOGY(flags)) {
                                snprintf(topology, sizeof(topology),
@@ -1066,7 +1066,7 @@ void write_json_node_stats(int tab, unsigned long long deltot_jiffies,
 
                if (node == 0) {
                        /* This is node "all", i.e. CPU "all" */
-                       strcpy(node_name, "all");
+                       strcpy(node_name, K_LOWERALL);
                }
                else {
                        snprintf(node_name, sizeof(node_name), "%d", node - 1);
index 3121a9c0a697ee46566ce5309bd5a21953052d55..6945fb4077160cc7085fded3d6bc0d8d42bfe2bf 100644 (file)
@@ -104,7 +104,7 @@ void print_hdr_line(char *p_timestamp, struct activity *a, int pos, int iwidth,
                                        /* Don't display current item if offline */
                                        continue;
                                if (j == 0) {
-                                       printf(" %*s", vwidth, "all");
+                                       printf(" %*s", vwidth, K_LOWERALL);
                                }
                                else {
                                        snprintf(dfld, sizeof(dfld), "%s%d%s", cfld, j - 1, cfld + k + 1);
index d548ce6fccc0955db72f17c6b6b7e018911e0cbc..7d8929d0725db25d94510695bd85636df4017f74 100644 (file)
@@ -1345,7 +1345,7 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st
                        pos = i * CPU_ARRAY_SZ;
                        if (!i) {
                                /* This is CPU "all" */
-                               strcpy(item_name, "all");
+                               strcpy(item_name, K_LOWERALL);
                        }
                        else {
                                sprintf(item_name, "%d", i - 1);
@@ -4316,7 +4316,7 @@ __print_funct_t svg_print_pwr_cpufreq_stats(struct activity *a, int curr, int ac
 
                        if (!i) {
                                /* This is CPU "all" */
-                               strcpy(item_name, "all");
+                               strcpy(item_name, K_LOWERALL);
                        }
                        else {
                                /*
@@ -5263,7 +5263,7 @@ __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action
 
                        if (!i) {
                                /* This is CPU "all" */
-                               strcpy(item_name, "all");
+                               strcpy(item_name, K_LOWERALL);
                        }
                        else {
                                sprintf(item_name, "%d", i - 1);
index a01a12d57df4e68f61e0c5867b2f32b845c91189..537f740bcc3c7bea44d727df852f22845f0b66ac 100644 (file)
@@ -168,7 +168,7 @@ __print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
 
                if (i == 0) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
 
                        if (a->nr_ini == 1) {
                                /*
@@ -1804,7 +1804,7 @@ __print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int ta
                /* Yes: Display it */
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);
@@ -2054,7 +2054,7 @@ __print_funct_t xml_print_pwr_wghfreq_stats(struct activity *a, int curr, int ta
 
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);
@@ -2305,7 +2305,7 @@ __print_funct_t xml_print_softnet_stats(struct activity *a, int curr, int tab,
                /* Yes: Display it */
                if (!i) {
                        /* This is CPU "all" */
-                       strcpy(cpuno, "all");
+                       strcpy(cpuno, K_LOWERALL);
                }
                else {
                        sprintf(cpuno, "%d", i - 1);