From 72ce39de3e428decfb1d29aa33ea81e0386c4441 Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Sat, 13 Jun 2015 19:34:20 +0900 Subject: [PATCH] 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. --- src/sysinfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sysinfo.cc b/src/sysinfo.cc index 45355869..13ef2f89 100644 --- a/src/sysinfo.cc +++ b/src/sysinfo.cc @@ -267,7 +267,7 @@ void InitializeSystemInfo() { int num_cpus = 0; size_t size = sizeof(num_cpus); 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 && (size == sizeof(num_cpus))) cpuinfo_num_cpus = num_cpus;