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

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

Issue 2720703004: allocator: Fix function type mismatch in allocator function definitions. (Closed)
Patch Set: 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 // Its purpose is to SHIM_ALIAS_SYMBOL the Libc symbols for malloc/new to the 5 // Its purpose is to SHIM_ALIAS_SYMBOL the Libc symbols for malloc/new to the
6 // shim layer entry points. 6 // shim layer entry points.
7 7
8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_ 8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_
9 #error This header is meant to be included only once by allocator_shim.cc 9 #error This header is meant to be included only once by allocator_shim.cc
10 #endif 10 #endif
11 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_ 11 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_
12 12
13 #include <malloc.h> 13 #include <malloc.h>
14 14
15 #include "base/allocator/allocator_shim_internals.h" 15 #include "base/allocator/allocator_shim_internals.h"
16 16
17 extern "C" { 17 extern "C" {
18 18
19 SHIM_ALWAYS_EXPORT void* malloc(size_t size) __THROW 19 SHIM_ALWAYS_EXPORT void* malloc(size_t size) __THROW {
20 SHIM_ALIAS_SYMBOL(ShimMalloc); 20 return ShimMalloc(size, nullptr);
21 }
21 22
22 SHIM_ALWAYS_EXPORT void free(void* ptr) __THROW 23 SHIM_ALWAYS_EXPORT void free(void* ptr) __THROW {
23 SHIM_ALIAS_SYMBOL(ShimFree); 24 ShimFree(ptr, nullptr);
25 }
24 26
25 SHIM_ALWAYS_EXPORT void* realloc(void* ptr, size_t size) __THROW 27 SHIM_ALWAYS_EXPORT void* realloc(void* ptr, size_t size) __THROW {
26 SHIM_ALIAS_SYMBOL(ShimRealloc); 28 return ShimRealloc(ptr, size, nullptr);
29 }
27 30
28 SHIM_ALWAYS_EXPORT void* calloc(size_t n, size_t size) __THROW 31 SHIM_ALWAYS_EXPORT void* calloc(size_t n, size_t size) __THROW {
29 SHIM_ALIAS_SYMBOL(ShimCalloc); 32 return ShimCalloc(n, size, nullptr);
33 }
30 34
31 SHIM_ALWAYS_EXPORT void cfree(void* ptr) __THROW 35 SHIM_ALWAYS_EXPORT void cfree(void* ptr) __THROW {
32 SHIM_ALIAS_SYMBOL(ShimFree); 36 ShimFree(ptr, nullptr);
37 }
33 38
34 SHIM_ALWAYS_EXPORT void* memalign(size_t align, size_t s) __THROW 39 SHIM_ALWAYS_EXPORT void* memalign(size_t align, size_t s) __THROW {
35 SHIM_ALIAS_SYMBOL(ShimMemalign); 40 return ShimMemalign(align, s, nullptr);
41 }
36 42
37 SHIM_ALWAYS_EXPORT void* valloc(size_t size) __THROW 43 SHIM_ALWAYS_EXPORT void* valloc(size_t size) __THROW {
38 SHIM_ALIAS_SYMBOL(ShimValloc); 44 return ShimValloc(size, nullptr);
45 }
39 46
40 SHIM_ALWAYS_EXPORT void* pvalloc(size_t size) __THROW 47 SHIM_ALWAYS_EXPORT void* pvalloc(size_t size) __THROW
41 SHIM_ALIAS_SYMBOL(ShimPvalloc); 48 SHIM_ALIAS_SYMBOL(ShimPvalloc);
42 49
43 SHIM_ALWAYS_EXPORT int posix_memalign(void** r, size_t a, size_t s) __THROW 50 SHIM_ALWAYS_EXPORT int posix_memalign(void** r, size_t a, size_t s) __THROW
44 SHIM_ALIAS_SYMBOL(ShimPosixMemalign); 51 SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
45 52
46 // The default dispatch translation unit has to define also the following 53 // The default dispatch translation unit has to define also the following
47 // symbols (unless they are ultimately routed to the system symbols): 54 // symbols (unless they are ultimately routed to the system symbols):
48 // void malloc_stats(void); 55 // void malloc_stats(void);
49 // int mallopt(int, int); 56 // int mallopt(int, int);
50 // struct mallinfo mallinfo(void); 57 // struct mallinfo mallinfo(void);
51 // size_t malloc_size(void*); 58 // size_t malloc_size(void*);
52 // size_t malloc_usable_size(const void*); 59 // size_t malloc_usable_size(const void*);
53 60
54 } // extern "C" 61 } // extern "C"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698