diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-03 11:53:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-03 11:53:05 +0200 |
commit | 45a73d2b472ffcc0d87f3efae3424c44976d6935 (patch) | |
tree | 454bf430eab79d20b8a7c4ac609ee70260188a16 /libavutil/cpu.c | |
parent | 7cb5467a52011d194289035b51e27c4df80bf2a2 (diff) | |
parent | c011ceef78eae66039efc66d9551a7146e08838a (diff) | |
download | ffmpeg-45a73d2b472ffcc0d87f3efae3424c44976d6935.tar.gz |
Merge commit 'c011ceef78eae66039efc66d9551a7146e08838a'
* commit 'c011ceef78eae66039efc66d9551a7146e08838a':
swscale: ppc: Remove commented-out define cruft
nsvdec: Remove commented-out debug cruft
cpu: Restructure code to avoid pointless ret variable indirection
Conflicts:
libavutil/cpu.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r-- | libavutil/cpu.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 10e15ba668..cdea209d8d 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -200,27 +200,23 @@ int av_cpu_count(void) { static volatile int printed; - 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); |