Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Side by Side Diff: base/allocator/allocator_shim_override_glibc_weak_symbols.h

Issue 2720703004: allocator: Fix function type mismatch in allocator function definitions. (Closed)
Patch Set: Change shim functions to be ALWAYS_INLINE and replace all aliases with calls Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ 5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
6 #error This header is meant to be included only once by allocator_shim.cc 6 #error This header is meant to be included only once by allocator_shim.cc
7 #endif 7 #endif
8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ 8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
9 9
10 // Alias the internal Glibc symbols to the shim entry points. 10 // Alias the internal Glibc symbols to the shim entry points.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const void*) = 69 const void*) =
70 &GlibcFreeHook; 70 &GlibcFreeHook;
71 71
72 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)( 72 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)(
73 size_t, 73 size_t,
74 size_t, 74 size_t,
75 const void*) = &GlibcMemalignHook; 75 const void*) = &GlibcMemalignHook;
76 76
77 // 2) Redefine libc symbols themselves. 77 // 2) Redefine libc symbols themselves.
78 78
79 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) 79 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) {
80 SHIM_ALIAS_SYMBOL(ShimMalloc); 80 return ShimMalloc(size, nullptr);
81 }
81 82
82 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) SHIM_ALIAS_SYMBOL(ShimFree); 83 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) {
84 ShimFree(ptr, nullptr);
85 }
83 86
84 SHIM_ALWAYS_EXPORT void* __libc_realloc(void* ptr, size_t size) 87 SHIM_ALWAYS_EXPORT void* __libc_realloc(void* ptr, size_t size) {
85 SHIM_ALIAS_SYMBOL(ShimRealloc); 88 return ShimRealloc(ptr, size, nullptr);
89 }
86 90
87 SHIM_ALWAYS_EXPORT void* __libc_calloc(size_t n, size_t size) 91 SHIM_ALWAYS_EXPORT void* __libc_calloc(size_t n, size_t size) {
88 SHIM_ALIAS_SYMBOL(ShimCalloc); 92 return ShimCalloc(n, size, nullptr);
93 }
89 94
90 SHIM_ALWAYS_EXPORT void __libc_cfree(void* ptr) SHIM_ALIAS_SYMBOL(ShimFree); 95 SHIM_ALWAYS_EXPORT void __libc_cfree(void* ptr) {
96 return ShimFree(ptr, nullptr);
97 }
91 98
92 SHIM_ALWAYS_EXPORT void* __libc_memalign(size_t align, size_t s) 99 SHIM_ALWAYS_EXPORT void* __libc_memalign(size_t align, size_t s) {
93 SHIM_ALIAS_SYMBOL(ShimMemalign); 100 return ShimMemalign(align, s, nullptr);
101 }
94 102
95 SHIM_ALWAYS_EXPORT void* __libc_valloc(size_t size) 103 SHIM_ALWAYS_EXPORT void* __libc_valloc(size_t size) {
96 SHIM_ALIAS_SYMBOL(ShimValloc); 104 return ShimValloc(size, nullptr);
105 }
97 106
98 SHIM_ALWAYS_EXPORT void* __libc_pvalloc(size_t size) 107 SHIM_ALWAYS_EXPORT void* __libc_pvalloc(size_t size) {
99 SHIM_ALIAS_SYMBOL(ShimPvalloc); 108 return ShimPvalloc(size);
109 }
100 110
101 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) 111 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) {
102 SHIM_ALIAS_SYMBOL(ShimPosixMemalign); 112 return ShimPosixMemalign(r, a, s);
113 }
103 114
104 } // extern "C" 115 } // extern "C"
105 116
106 // Safety check. 117 // Safety check.
107 #if !defined(__GLIBC__) 118 #if !defined(__GLIBC__)
108 #error The target platform does not seem to use Glibc. Disable the allocator \ 119 #error The target platform does not seem to use Glibc. Disable the allocator \
109 shim by setting use_experimental_allocator_shim=false in GN args. 120 shim by setting use_experimental_allocator_shim=false in GN args.
110 #endif 121 #endif
OLDNEW
« no previous file with comments | « base/allocator/allocator_shim_override_cpp_symbols.h ('k') | base/allocator/allocator_shim_override_libc_symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698