diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 17273b638b..6384d6d7e7 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -130,27 +130,23 @@ int av_parse_cpu_flags(const char *s) int av_cpu_count(void) { - int ret, nb_cpus = 1; + int nb_cpus = 1; #if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT) cpu_set_t cpuset; CPU_ZERO(&cpuset); - ret = sched_getaffinity(0, sizeof(cpuset), &cpuset); - if (!ret) { + if (!sched_getaffinity(0, sizeof(cpuset), &cpuset)) nb_cpus = CPU_COUNT(&cpuset); - } #elif HAVE_GETPROCESSAFFINITYMASK DWORD_PTR proc_aff, sys_aff; - ret = GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff); - if (ret) + if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff)) nb_cpus = av_popcount64(proc_aff); #elif HAVE_SYSCTL && defined(HW_NCPU) int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof(nb_cpus); - ret = sysctl(mib, 2, &nb_cpus, &len, NULL, 0); - if (ret == -1) + if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1) nb_cpus = 0; #elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN) nb_cpus = sysconf(_SC_NPROC_ONLN);