Differential D18757 Diff 55245 www/qt5-webengine/files/patch-src_3rdparty_chromium_base_allocator_allocator__shim__default__dispatch__to__glibc.cc
Changeset View
Changeset View
Standalone View
Standalone View
www/qt5-webengine/files/patch-src_3rdparty_chromium_base_allocator_allocator__shim__default__dispatch__to__glibc.cc
--- src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2017-01-26 00:49:07 UTC | --- src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2018-11-13 18:25:11 UTC | ||||
+++ src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc | +++ src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc | ||||
@@ -3,19 +3,28 @@ | @@ -4,18 +4,28 @@ | ||||
// found in the LICENSE file. | |||||
#include "base/allocator/allocator_shim.h" | #include "base/allocator/allocator_shim.h" | ||||
- | |||||
-#include <malloc.h> | -#include <malloc.h> | ||||
+#include <stdio.h> | +#include <stdio.h> | ||||
+#include <stdlib.h> | +#include <stdlib.h> | ||||
+#include <malloc_np.h> | +#include <malloc_np.h> | ||||
// This translation unit defines a default dispatch for the allocator shim which | // This translation unit defines a default dispatch for the allocator shim which | ||||
// routes allocations to libc functions. | // routes allocations to libc functions. | ||||
-// The code here is strongly inspired from tcmalloc's libc_override_glibc.h. | -// The code here is strongly inspired from tcmalloc's libc_override_glibc.h. | ||||
Show All 16 Lines | |||||
+ return ret; | + return ret; | ||||
+ } | + } | ||||
+} | +} | ||||
+int __posix_memalign(void **ptr, size_t alignment, size_t size); | +int __posix_memalign(void **ptr, size_t alignment, size_t size); | ||||
+void __free(void* ptr); | +void __free(void* ptr); | ||||
} // extern "C" | } // extern "C" | ||||
namespace { | namespace { | ||||
@@ -23,23 +32,23 @@ namespace { | @@ -23,32 +33,32 @@ namespace { | ||||
using base::allocator::AllocatorDispatch; | using base::allocator::AllocatorDispatch; | ||||
void* GlibcMalloc(const AllocatorDispatch*, size_t size) { | void* GlibcMalloc(const AllocatorDispatch*, size_t size, void* context) { | ||||
- return __libc_malloc(size); | - return __libc_malloc(size); | ||||
+ return __malloc(size); | + return __malloc(size); | ||||
} | } | ||||
void* GlibcCalloc(const AllocatorDispatch*, size_t n, size_t size) { | void* GlibcCalloc(const AllocatorDispatch*, | ||||
size_t n, | |||||
size_t size, | |||||
void* context) { | |||||
- return __libc_calloc(n, size); | - return __libc_calloc(n, size); | ||||
+ return __calloc(n, size); | + return __calloc(n, size); | ||||
} | } | ||||
void* GlibcRealloc(const AllocatorDispatch*, void* address, size_t size) { | void* GlibcRealloc(const AllocatorDispatch*, | ||||
void* address, | |||||
size_t size, | |||||
void* context) { | |||||
- return __libc_realloc(address, size); | - return __libc_realloc(address, size); | ||||
+ return __realloc(address, size); | + return __realloc(address, size); | ||||
} | } | ||||
void* GlibcMemalign(const AllocatorDispatch*, size_t alignment, size_t size) { | void* GlibcMemalign(const AllocatorDispatch*, | ||||
size_t alignment, | |||||
size_t size, | |||||
void* context) { | |||||
- return __libc_memalign(alignment, size); | - return __libc_memalign(alignment, size); | ||||
+ return __memalign(alignment, size); | + return __memalign(alignment, size); | ||||
} | } | ||||
void GlibcFree(const AllocatorDispatch*, void* address) { | void GlibcFree(const AllocatorDispatch*, void* address, void* context) { | ||||
- __libc_free(address); | - __libc_free(address); | ||||
+ __free(address); | + __free(address); | ||||
} | } | ||||
size_t GlibcGetSizeEstimate(const AllocatorDispatch*, void* address) { | size_t GlibcGetSizeEstimate(const AllocatorDispatch*, |