OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // Its purpose is to SHIM_ALIAS_SYMBOL the Libc symbols for malloc/new to the | |
Primiano Tucci (use gerrit)
2016/07/15 14:02:10
I think this comment needs to be reworded, this do
Sigurður Ásgeirsson
2016/07/18 19:27:07
Argh - copy/paste strikes again - sorry.
| |
6 // shim layer entry points. | |
7 | |
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 | |
10 #endif | |
11 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_ | |
12 | |
13 #include <malloc.h> | |
14 | |
15 #include "base/allocator/allocator_shim_internals.h" | |
Primiano Tucci (use gerrit)
2016/07/15 14:02:10
I don't htink you need this header at this point.
Sigurður Ásgeirsson
2016/07/18 19:27:06
Done.
| |
16 | |
17 extern "C" { | |
18 | |
19 // These symbols override the CRT's implementation of the same functions. | |
20 __declspec(restrict) void* malloc(size_t size) { | |
21 return ShimMalloc(size); | |
22 } | |
23 | |
24 void free(void* ptr) { | |
25 ShimFree(ptr); | |
26 } | |
27 | |
28 __declspec(restrict) void* realloc(void* ptr, size_t size) { | |
29 return ShimRealloc(ptr, size); | |
30 } | |
31 | |
32 __declspec(restrict) void* calloc(size_t n, size_t size) { | |
33 return ShimCalloc(n, size); | |
34 } | |
35 | |
36 // The default dispatch translation unit has to define also the following | |
37 // symbols (unless they are ultimately routed to the system symbols): | |
38 // void malloc_stats(void); | |
39 // int mallopt(int, int); | |
40 // struct mallinfo mallinfo(void); | |
41 // size_t malloc_size(void*); | |
42 // size_t malloc_usable_size(const void*); | |
43 | |
44 } // extern "C" | |
OLD | NEW |