common: switch to nullptr for sysctl's empty new value
This commit is contained in:
parent
e6085ea35f
commit
3b1683a152
1 changed files with 4 additions and 4 deletions
|
@ -40,16 +40,16 @@ static MemoryInfo Detect() {
|
||||||
// hw and vm are defined in sysctl.h
|
// hw and vm are defined in sysctl.h
|
||||||
// https://github.com/apple/darwin-xnu/blob/master/bsd/sys/sysctl.h#L471
|
// https://github.com/apple/darwin-xnu/blob/master/bsd/sys/sysctl.h#L471
|
||||||
// sysctlbyname(const char *, void *, size_t *, void *, size_t);
|
// sysctlbyname(const char *, void *, size_t *, void *, size_t);
|
||||||
sysctlbyname("hw.memsize", &ramsize, &sizeof_ramsize, NULL, 0);
|
sysctlbyname("hw.memsize", &ramsize, &sizeof_ramsize, nullptr, 0);
|
||||||
sysctlbyname("vm.swapusage", &vmusage, &sizeof_vmusage, NULL, 0);
|
sysctlbyname("vm.swapusage", &vmusage, &sizeof_vmusage, nullptr, 0);
|
||||||
mem_info.TotalPhysicalMemory = ramsize;
|
mem_info.TotalPhysicalMemory = ramsize;
|
||||||
mem_info.TotalSwapMemory = vmusage.xsu_total;
|
mem_info.TotalSwapMemory = vmusage.xsu_total;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
u_long physmem, swap_total;
|
u_long physmem, swap_total;
|
||||||
std::size_t sizeof_u_long = sizeof(u_long);
|
std::size_t sizeof_u_long = sizeof(u_long);
|
||||||
// sysctlbyname(const char *, void *, size_t *, const void *, size_t);
|
// sysctlbyname(const char *, void *, size_t *, const void *, size_t);
|
||||||
sysctlbyname("hw.physmem", &physmem, &sizeof_u_long, NULL, 0);
|
sysctlbyname("hw.physmem", &physmem, &sizeof_u_long, nullptr, 0);
|
||||||
sysctlbyname("vm.swap_total", &swap_total, &sizeof_u_long, NULL, 0);
|
sysctlbyname("vm.swap_total", &swap_total, &sizeof_u_long, nullptr, 0);
|
||||||
mem_info.TotalPhysicalMemory = physmem;
|
mem_info.TotalPhysicalMemory = physmem;
|
||||||
mem_info.TotalSwapMemory = swap_total;
|
mem_info.TotalSwapMemory = swap_total;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
|
|
Loading…
Reference in a new issue