From d06f0b0c4a227eb4235e341a6ab1b1466d1a09b1 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Sun, 3 May 2020 17:22:14 -0700 Subject: Remove redundant check from gen_machine_id() --- modules/benchmark/bench_results.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'modules/benchmark') diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index 9c5121a9..e305ee28 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -136,21 +136,19 @@ static int cpu_config_is_close(char *str0, char *str1) static void gen_machine_id(bench_machine *m) { char *s; + if (m) { if (m->mid != NULL) free(m->mid); + /* Don't try and translate unknown. The mid string needs to be made of * all untranslated elements.*/ m->mid = g_strdup_printf("%s;%s;%.2f", (m->board != NULL) ? m->board : "(Unknown)", m->cpu_name, cpu_config_val(m->cpu_config)); - s = m->mid; - while (*s != 0) { - if (!isalnum(*s)) { - if (*s != ';' && *s != '(' && *s != '(' && *s != ')') - *s = '_'; - } - s++; + for (s = m->mid; *s; s++) { + if (!isalnum(*s) && (*s != '(' || *s != ')' || *s != ';')) + *s = '_'; } } } -- cgit v1.2.3