| OLD | NEW |
| 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 // This header defines symbols to override the same functions in the Visual C++ | 5 // This header defines symbols to override the same functions in the Visual C++ |
| 6 // CRT implementation. | 6 // CRT implementation. |
| 7 | 7 |
| 8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_ | 8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_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 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return old_mode; | 41 return old_mode; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Replaces _query_new_mode in ucrt\heap\new_mode.cpp | 44 // Replaces _query_new_mode in ucrt\heap\new_mode.cpp |
| 45 int _query_new_mode() { | 45 int _query_new_mode() { |
| 46 return win_new_mode; | 46 return win_new_mode; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // These symbols override the CRT's implementation of the same functions. | 49 // These symbols override the CRT's implementation of the same functions. |
| 50 __declspec(restrict) void* malloc(size_t size) { | 50 __declspec(restrict) void* malloc(size_t size) { |
| 51 return ShimMalloc(size); | 51 return ShimMalloc(size, nullptr); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void free(void* ptr) { | 54 void free(void* ptr) { |
| 55 ShimFree(ptr); | 55 ShimFree(ptr, nullptr); |
| 56 } | 56 } |
| 57 | 57 |
| 58 __declspec(restrict) void* realloc(void* ptr, size_t size) { | 58 __declspec(restrict) void* realloc(void* ptr, size_t size) { |
| 59 return ShimRealloc(ptr, size); | 59 return ShimRealloc(ptr, size, nullptr); |
| 60 } | 60 } |
| 61 | 61 |
| 62 __declspec(restrict) void* calloc(size_t n, size_t size) { | 62 __declspec(restrict) void* calloc(size_t n, size_t size) { |
| 63 return ShimCalloc(n, size); | 63 return ShimCalloc(n, size, nullptr); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // The symbols | 66 // The symbols |
| 67 // * __acrt_heap | 67 // * __acrt_heap |
| 68 // * __acrt_initialize_heap | 68 // * __acrt_initialize_heap |
| 69 // * __acrt_uninitialize_heap | 69 // * __acrt_uninitialize_heap |
| 70 // * _get_heap_handle | 70 // * _get_heap_handle |
| 71 // must be overridden all or none, as they are otherwise supplied | 71 // must be overridden all or none, as they are otherwise supplied |
| 72 // by heap_handle.obj in the ucrt.lib file. | 72 // by heap_handle.obj in the ucrt.lib file. |
| 73 HANDLE __acrt_heap = nullptr; | 73 HANDLE __acrt_heap = nullptr; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 89 | 89 |
| 90 // The default dispatch translation unit has to define also the following | 90 // The default dispatch translation unit has to define also the following |
| 91 // symbols (unless they are ultimately routed to the system symbols): | 91 // symbols (unless they are ultimately routed to the system symbols): |
| 92 // void malloc_stats(void); | 92 // void malloc_stats(void); |
| 93 // int mallopt(int, int); | 93 // int mallopt(int, int); |
| 94 // struct mallinfo mallinfo(void); | 94 // struct mallinfo mallinfo(void); |
| 95 // size_t malloc_size(void*); | 95 // size_t malloc_size(void*); |
| 96 // size_t malloc_usable_size(const void*); | 96 // size_t malloc_usable_size(const void*); |
| 97 | 97 |
| 98 } // extern "C" | 98 } // extern "C" |
| OLD | NEW |