OLD | NEW |
1 /* Copyright (c) 2003, Google Inc. | 1 /* Copyright (c) 2003, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 * | 29 * |
30 * --- | 30 * --- |
31 * Author: Sanjay Ghemawat <opensource@google.com> | 31 * Author: Sanjay Ghemawat <opensource@google.com> |
32 * .h.in file by Craig Silverstein <opensource@google.com> | 32 * .h.in file by Craig Silverstein <opensource@google.com> |
33 */ | 33 */ |
34 | 34 |
35 #ifndef TCMALLOC_TCMALLOC_H_ | 35 #ifndef TCMALLOC_TCMALLOC_H_ |
36 #define TCMALLOC_TCMALLOC_H_ | 36 #define TCMALLOC_TCMALLOC_H_ |
37 | 37 |
| 38 #include <stddef.h> // for size_t |
| 39 #ifdef HAVE_SYS_CDEFS_H |
| 40 #include <sys/cdefs.h> // where glibc defines __THROW |
| 41 #endif |
| 42 |
38 // __THROW is defined in glibc systems. It means, counter-intuitively, | 43 // __THROW is defined in glibc systems. It means, counter-intuitively, |
39 // "This function will never throw an exception." It's an optional | 44 // "This function will never throw an exception." It's an optional |
40 // optimization tool, but we may need to use it to match glibc prototypes. | 45 // optimization tool, but we may need to use it to match glibc prototypes. |
41 #ifndef __THROW /* I guess we're not on a glibc system */ | 46 #ifndef __THROW /* I guess we're not on a glibc system */ |
42 # define __THROW /* __THROW is just an optimization, so ok to make it "" */ | 47 # define __THROW /* __THROW is just an optimization, so ok to make it "" */ |
43 #endif | 48 #endif |
44 | 49 |
45 // Define the version number so folks can check against it | 50 // Define the version number so folks can check against it |
46 #define TC_VERSION_MAJOR @TC_VERSION_MAJOR@ | 51 #define TC_VERSION_MAJOR @TC_VERSION_MAJOR@ |
47 #define TC_VERSION_MINOR @TC_VERSION_MINOR@ | 52 #define TC_VERSION_MINOR @TC_VERSION_MINOR@ |
48 #define TC_VERSION_PATCH "@TC_VERSION_PATCH@" | 53 #define TC_VERSION_PATCH "@TC_VERSION_PATCH@" |
49 #define TC_VERSION_STRING "google-perftools @TC_VERSION_MAJOR@.@TC_VERSION_MINOR
@@TC_VERSION_PATCH@" | 54 #define TC_VERSION_STRING "gperftools @TC_VERSION_MAJOR@.@TC_VERSION_MINOR@@TC_V
ERSION_PATCH@" |
50 | 55 |
51 #include <stdlib.h> // for struct mallinfo, if it's defined | 56 #include <stdlib.h> // for struct mallinfo, if it's defined |
52 | 57 |
53 // Annoying stuff for windows -- makes sure clients can import these functions | 58 // Annoying stuff for windows -- makes sure clients can import these functions |
54 #ifndef PERFTOOLS_DLL_DECL | 59 #ifndef PERFTOOLS_DLL_DECL |
55 # ifdef _WIN32 | 60 # ifdef _WIN32 |
56 # define PERFTOOLS_DLL_DECL __declspec(dllimport) | 61 # define PERFTOOLS_DLL_DECL __declspec(dllimport) |
57 # else | 62 # else |
58 # define PERFTOOLS_DLL_DECL | 63 # define PERFTOOLS_DLL_DECL |
59 # endif | 64 # endif |
60 #endif | 65 #endif |
61 | 66 |
62 #ifdef __cplusplus | 67 #ifdef __cplusplus |
63 #include <new> // for std::nothrow_t | 68 namespace std { |
| 69 struct nothrow_t; |
| 70 } |
64 | 71 |
65 extern "C" { | 72 extern "C" { |
66 #endif | 73 #endif |
67 // Returns a human-readable version string. If major, minor, | 74 // Returns a human-readable version string. If major, minor, |
68 // and/or patch are not NULL, they are set to the major version, | 75 // and/or patch are not NULL, they are set to the major version, |
69 // minor version, and patch-code (a string, usually ""). | 76 // minor version, and patch-code (a string, usually ""). |
70 PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor, | 77 PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor, |
71 const char** patch) __THROW; | 78 const char** patch) __THROW; |
72 | 79 |
73 PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW; | 80 PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); | 114 PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); |
108 PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, | 115 PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, |
109 const std::nothrow_t&) __THROW; | 116 const std::nothrow_t&) __THROW; |
110 PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; | 117 PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; |
111 PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, | 118 PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, |
112 const std::nothrow_t&) __THROW; | 119 const std::nothrow_t&) __THROW; |
113 } | 120 } |
114 #endif | 121 #endif |
115 | 122 |
116 #endif // #ifndef TCMALLOC_TCMALLOC_H_ | 123 #endif // #ifndef TCMALLOC_TCMALLOC_H_ |
OLD | NEW |