From 34bba19782ebb12b3f7c1bb70e4e2beb94e1240d Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 12 Feb 2022 18:07:10 +0100 Subject: [PATCH] Use strings definition whenever possible Signed-off-by: Sebastien GODARD --- ioconf.c | 2 +- json_stats.c | 8 ++++---- mpstat.c | 4 ++-- pr_stats.c | 2 +- svg_stats.c | 6 +++--- xml_stats.c | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ioconf.c b/ioconf.c index 94af735..ea2c578 100644 --- 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) diff --git a/json_stats.c b/json_stats.c index 5b989ea..fe090d3 100644 --- a/json_stats.c +++ b/json_stats.c @@ -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); diff --git a/mpstat.c b/mpstat.c index a63eb05..3f6944d 100644 --- 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); diff --git a/pr_stats.c b/pr_stats.c index 3121a9c..6945fb4 100644 --- a/pr_stats.c +++ b/pr_stats.c @@ -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); diff --git a/svg_stats.c b/svg_stats.c index d548ce6..7d8929d 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -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); diff --git a/xml_stats.c b/xml_stats.c index a01a12d..537f740 100644 --- a/xml_stats.c +++ b/xml_stats.c @@ -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); -- 2.40.0