Chromium Code Reviews| Index: base/allocator/allocator_shim_override_ucrt_symbols_win.h |
| diff --git a/base/allocator/allocator_shim_override_ucrt_symbols_win.h b/base/allocator/allocator_shim_override_ucrt_symbols_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bbae132054c655904bb671641b00232dad5598df |
| --- /dev/null |
| +++ b/base/allocator/allocator_shim_override_ucrt_symbols_win.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// 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.
|
| +// shim layer entry points. |
| + |
| +#ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_ |
| +#error This header is meant to be included only once by allocator_shim.cc |
| +#endif |
| +#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_ |
| + |
| +#include <malloc.h> |
| + |
| +#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.
|
| + |
| +extern "C" { |
| + |
| +// These symbols override the CRT's implementation of the same functions. |
| +__declspec(restrict) void* malloc(size_t size) { |
| + return ShimMalloc(size); |
| +} |
| + |
| +void free(void* ptr) { |
| + ShimFree(ptr); |
| +} |
| + |
| +__declspec(restrict) void* realloc(void* ptr, size_t size) { |
| + return ShimRealloc(ptr, size); |
| +} |
| + |
| +__declspec(restrict) void* calloc(size_t n, size_t size) { |
| + return ShimCalloc(n, size); |
| +} |
| + |
| +// The default dispatch translation unit has to define also the following |
| +// symbols (unless they are ultimately routed to the system symbols): |
| +// void malloc_stats(void); |
| +// int mallopt(int, int); |
| +// struct mallinfo mallinfo(void); |
| +// size_t malloc_size(void*); |
| +// size_t malloc_usable_size(const void*); |
| + |
| +} // extern "C" |