Fix the compilation error against G++ on Mac OS X.

Using `0` as a null pointer is illegal when `-Wzero-as-null-pointer-constant`
is given to G++.  To avoid the warning `zero-as-null-pointer-constant`,
`nullptr` (C++11 keyword) instead of `0` is used in the `sysctl` invocation.
This commit is contained in:
Kaito Udagawa 2015-06-13 19:34:20 +09:00
parent d60945ac43
commit 72ce39de3e
1 changed files with 1 additions and 1 deletions

View File

@ -267,7 +267,7 @@ void InitializeSystemInfo() {
int num_cpus = 0; int num_cpus = 0;
size_t size = sizeof(num_cpus); size_t size = sizeof(num_cpus);
int numcpus_name[] = {CTL_HW, HW_NCPU}; int numcpus_name[] = {CTL_HW, HW_NCPU};
if (::sysctl(numcpus_name, arraysize(numcpus_name), &num_cpus, &size, 0, 0) == if (::sysctl(numcpus_name, arraysize(numcpus_name), &num_cpus, &size, nullptr, 0) ==
0 && 0 &&
(size == sizeof(num_cpus))) (size == sizeof(num_cpus)))
cpuinfo_num_cpus = num_cpus; cpuinfo_num_cpus = num_cpus;