Commit 05f22741 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

base/allocator: Fix conditional build settings of mallinfo

mallinfo is not a POSIX API and OS_APPLE doesn't support mallinfo
nor define 'struct mallinfo'.  Also <malloc.h> is not available on
OS_APPLE.

Change-Id: Ibe6834c7840e0e01aa85106cc6de0cf1ecf0fcf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505691Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822600}
parent df5c4300
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_POSIX) #if defined(OS_POSIX) && !defined(OS_APPLE)
#include <malloc.h> #include <malloc.h>
#endif #endif
...@@ -263,7 +263,8 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW { ...@@ -263,7 +263,8 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
#endif // !defined(OS_APPLE) #endif // !defined(OS_APPLE)
#if defined(OS_POSIX) // mallinfo is not a POSIX API and OS_APPLE doesn't support it.
#if defined(OS_POSIX) && !defined(OS_APPLE)
SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW { SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
base::SimplePartitionStatsDumper allocator_dumper; base::SimplePartitionStatsDumper allocator_dumper;
Allocator()->DumpStats("malloc", true, &allocator_dumper); Allocator()->DumpStats("malloc", true, &allocator_dumper);
...@@ -287,6 +288,6 @@ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW { ...@@ -287,6 +288,6 @@ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
return info; return info;
} }
#endif // defined(OS_POSIX) #endif // defined(OS_POSIX) && !defined(OS_APPLE)
} // extern "C" } // extern "C"
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_POSIX) #if defined(OS_POSIX) && !defined(OS_APPLE)
#include <malloc.h> #include <malloc.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment