aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar smcgruer <smcgruer@google.com>2015-03-16 14:45:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-16 14:45:01 -0700
commitb83205a538f420fd78220519540503616cf636cd (patch)
tree1a650526823b328a6d9fdb593e58d9aa604fe249
parent6f7f2012eed634695dc76aad720d3ee0820bd9d2 (diff)
Fix build for UCLIBC platforms
malloc_usable_size does not exist in UCLIBC, so fall back to just returning 0 for SkVarAlloc::heap_size(). BUG=skia: Review URL: https://codereview.chromium.org/1006073003
-rw-r--r--src/core/SkVarAlloc.cpp4
-rw-r--r--tests/VarAllocTest.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index ba5d6f50b0..88bd17028f 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -47,7 +47,7 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
#if defined(SK_BUILD_FOR_MAC)
SkASSERT(alloc == malloc_good_size(alloc));
-#elif defined(SK_BUILD_FOR_UNIX)
+#elif defined(SK_BUILD_FOR_UNIX) && !defined(__UCLIBC__)
// TODO(mtklein): tune so we can assert something like this
//SkASSERT(alloc == malloc_usable_size(fBlock));
#endif
@@ -56,7 +56,7 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
static size_t heap_size(void* p) {
#if defined(SK_BUILD_FOR_MAC)
return malloc_size(p);
-#elif defined(SK_BUILD_FOR_UNIX)
+#elif defined(SK_BUILD_FOR_UNIX) && !defined(__UCLIBC__)
return malloc_usable_size(p);
#elif defined(SK_BUILD_FOR_WIN32)
return _msize(p);
diff --git a/tests/VarAllocTest.cpp b/tests/VarAllocTest.cpp
index 18e421480d..b1a0cb352f 100644
--- a/tests/VarAllocTest.cpp
+++ b/tests/VarAllocTest.cpp
@@ -6,8 +6,8 @@ DEF_TEST(VarAlloc, r) {
char* p = va.alloc(128, SK_MALLOC_THROW);
sk_bzero(p, 128); // Just checking this is safe.
-#ifndef SK_BUILD_FOR_ANDROID
- // This method will always return 0 on Android.
+#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
+ // This method will always return 0 on Android and UCLIBC platforms.
REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
#endif
}