Index: runtime/vm/cpuinfo_macos.cc |
diff --git a/runtime/vm/cpuinfo_macos.cc b/runtime/vm/cpuinfo_macos.cc |
index 63523914ddf4c2bd581ebe4e2edb897b2e3c46cd..508851ae0978087dc8d8eeaa8c36ab3eac0a9b7c 100644 |
--- a/runtime/vm/cpuinfo_macos.cc |
+++ b/runtime/vm/cpuinfo_macos.cc |
@@ -31,10 +31,10 @@ void CpuInfo::InitOnce() { |
void CpuInfo::Cleanup() {} |
-bool CpuInfo::FieldContainsByString(const char* field, |
- const char* search_string) { |
+bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { |
ASSERT(method_ != kCpuInfoDefault); |
ASSERT(search_string != NULL); |
+ const char* field = FieldName[idx]; |
char dest[1024]; |
size_t dest_len = 1024; |
@@ -48,14 +48,9 @@ bool CpuInfo::FieldContainsByString(const char* field, |
} |
-bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { |
- ASSERT(method_ != kCpuInfoDefault); |
- return FieldContainsByString(FieldName(idx), search_string); |
-} |
- |
- |
-const char* CpuInfo::ExtractFieldByString(const char* field) { |
+const char* CpuInfo::ExtractField(CpuInfoIndices idx) { |
ASSERT(method_ != kCpuInfoDefault); |
+ const char* field = FieldName(idx); |
ASSERT(field != NULL); |
size_t result_len; |
@@ -65,7 +60,7 @@ const char* CpuInfo::ExtractFieldByString(const char* field) { |
return 0; |
} |
- char* result = new char[result_len]; |
+ char* result = reinterpret_cast<char*>(malloc(result_len)); |
if (sysctlbyname(field, result, &result_len, NULL, 0) != 0) { |
UNREACHABLE(); |
return 0; |
@@ -75,12 +70,6 @@ const char* CpuInfo::ExtractFieldByString(const char* field) { |
} |
-const char* CpuInfo::ExtractField(CpuInfoIndices idx) { |
- ASSERT(method_ != kCpuInfoDefault); |
- return ExtractFieldByString(FieldName(idx)); |
-} |
- |
- |
bool CpuInfo::HasField(const char* field) { |
ASSERT(method_ != kCpuInfoDefault); |
ASSERT(field != NULL); |