From 44246892a0c2993a338dd5e11d07792bfe05ece9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Jun 2021 15:33:39 -0700 Subject: [PATCH] util: Trivial cleanup in the BSD code of util_cpu_detect_once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is going to be replicated in future commits, so tidy up a bit first. Acked-by: Marek Olšák Part-of: --- src/util/u_cpu_detect.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index b60ce165702..5890fcf59f3 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -571,13 +571,10 @@ util_cpu_detect_once(void) util_cpu_caps.nr_cpus = 1; # elif defined(PIPE_OS_BSD) { - int mib[2], ncpu; - int len; + const int mib[] = { CTL_HW, HW_NCPU }; + int ncpu; + int len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - - len = sizeof (ncpu); sysctl(mib, 2, &ncpu, &len, NULL, 0); util_cpu_caps.nr_cpus = ncpu; }