summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host')
-rw-r--r--lldb/source/Host/common/Host.cpp5
-rw-r--r--lldb/source/Host/common/Terminal.cpp3
2 files changed, 5 insertions, 3 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;
diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp
index 811d712ea0d..ca46eb0f744 100644
--- a/lldb/source/Host/common/Terminal.cpp
+++ b/lldb/source/Host/common/Terminal.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Terminal.h"
+#include "llvm/ADT/STLExtras.h"
#include <fcntl.h>
#include <signal.h>
@@ -274,7 +275,7 @@ TerminalStateSwitcher::~TerminalStateSwitcher ()
uint32_t
TerminalStateSwitcher::GetNumberOfStates() const
{
- return sizeof(m_ttystates)/sizeof(TerminalState);
+ return llvm::array_lengthof(m_ttystates);
}
//------------------------------------------------------------------
OpenPOWER on IntegriCloud