summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/Host.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/common/Host.cpp')
-rw-r--r--lldb/source/Host/common/Host.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 77341b11a44..edd64c678b6 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -66,6 +66,7 @@
#include "lldb/Target/TargetList.h"
#include "lldb/Utility/CleanUp.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/raw_ostream.h"
@@ -2063,7 +2064,7 @@ Host::GetNumberCPUS ()
#endif
/* get the number of CPUs from the system */
- if (sysctl(mib, sizeof(mib)/sizeof(int), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
+ if (sysctl(mib, llvm::array_lengthof(mib), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
{
g_num_cores = num_cores;
}
@@ -2071,7 +2072,7 @@ Host::GetNumberCPUS ()
{
mib[1] = HW_NCPU;
num_cores_len = sizeof(num_cores);
- if (sysctl(mib, sizeof(mib)/sizeof(int), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
+ if (sysctl(mib, llvm::array_lengthof(mib), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
{
if (num_cores > 0)
g_num_cores = num_cores;
OpenPOWER on IntegriCloud