зеркало из https://github.com/mozilla/moz-skia.git
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
This commit is contained in:
Родитель
6f7f2012ee
Коммит
b83205a538
|
@ -47,7 +47,7 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
|
||||||
|
|
||||||
#if defined(SK_BUILD_FOR_MAC)
|
#if defined(SK_BUILD_FOR_MAC)
|
||||||
SkASSERT(alloc == malloc_good_size(alloc));
|
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
|
// TODO(mtklein): tune so we can assert something like this
|
||||||
//SkASSERT(alloc == malloc_usable_size(fBlock));
|
//SkASSERT(alloc == malloc_usable_size(fBlock));
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
|
||||||
static size_t heap_size(void* p) {
|
static size_t heap_size(void* p) {
|
||||||
#if defined(SK_BUILD_FOR_MAC)
|
#if defined(SK_BUILD_FOR_MAC)
|
||||||
return malloc_size(p);
|
return malloc_size(p);
|
||||||
#elif defined(SK_BUILD_FOR_UNIX)
|
#elif defined(SK_BUILD_FOR_UNIX) && !defined(__UCLIBC__)
|
||||||
return malloc_usable_size(p);
|
return malloc_usable_size(p);
|
||||||
#elif defined(SK_BUILD_FOR_WIN32)
|
#elif defined(SK_BUILD_FOR_WIN32)
|
||||||
return _msize(p);
|
return _msize(p);
|
||||||
|
|
|
@ -6,8 +6,8 @@ DEF_TEST(VarAlloc, r) {
|
||||||
char* p = va.alloc(128, SK_MALLOC_THROW);
|
char* p = va.alloc(128, SK_MALLOC_THROW);
|
||||||
sk_bzero(p, 128); // Just checking this is safe.
|
sk_bzero(p, 128); // Just checking this is safe.
|
||||||
|
|
||||||
#ifndef SK_BUILD_FOR_ANDROID
|
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
|
||||||
// This method will always return 0 on Android.
|
// This method will always return 0 on Android and UCLIBC platforms.
|
||||||
REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
|
REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче