From ac8b73c5bde3165009f678dd6b3aa06b0b970e3b Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Sun, 3 May 2020 14:19:59 -0700 Subject: Move "need to cleanup CPU name" code to a helper function --- modules/benchmark/bench_results.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index 8637fd6b..9c5121a9 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -275,6 +275,12 @@ static int guess_threads_old_result(const char *bench_name, return threads_available; } +static gboolean cpu_name_needs_cleanup(const char *cpu_name) +{ + return strstr(cpu_name, "Intel") || strstr(cpu_name, "AMD") || + strstr(cpu_name, "VIA") || strstr(cpu_name, "Cyrix"); +} + bench_result * bench_result_benchmarkconf(const char *section, const char *key, char **values) { @@ -382,14 +388,9 @@ bench_result_benchmarkconf(const char *section, const char *key, char **values) b->machine->processors = -1; b->machine->cores = -1; - /* clean the old result's CPU model name - * if it was probably an x86 */ - if (strstr(b->machine->cpu_name, "Intel") || - strstr(b->machine->cpu_name, "AMD") || - strstr(b->machine->cpu_name, "VIA") || - strstr(b->machine->cpu_name, "Cyrix")) { + /* clean the old result's CPU model name if it was probably an x86 */ + if (cpu_name_needs_cleanup(b->machine->cpu_name)) nice_name_x86_cpuid_model_string(b->machine->cpu_name); - } } b->machine->cpu_config = -- cgit v1.2.3