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

Side by Side Diff: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/opj_malloc.h

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 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 /* 1 /*
2 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2005, Herve Drolon, FreeImage Team 7 * Copyright (c) 2005, Herve Drolon, FreeImage Team
8 * Copyright (c) 2007, Callum Lerwick <seg@haxxed.com> 8 * Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 /** @name Exported functions */ 44 /** @name Exported functions */
45 /*@{*/ 45 /*@{*/
46 /* ----------------------------------------------------------------------- */ 46 /* ----------------------------------------------------------------------- */
47 47
48 /** 48 /**
49 Allocate an uninitialized memory block 49 Allocate an uninitialized memory block
50 @param size Bytes to allocate 50 @param size Bytes to allocate
51 @return Returns a void pointer to the allocated space, or NULL if there is insuf ficient memory available 51 @return Returns a void pointer to the allocated space, or NULL if there is insuf ficient memory available
52 */ 52 */
53 #define _FOXIT_MEM_MANAGER_
54 #ifdef _FOXIT_MEM_MANAGER_
55 void* opj_malloc(size_t size);
56 void* opj_calloc(size_t _NumOfElements, size_t _SizeOfElements);
57 void* opj_realloc(void * m, size_t s);
58 void opj_free(void * m);
59 53
60 #define opj_aligned_malloc(size) opj_malloc(size)
61 #define opj_aligned_free(m) opj_free(m)
62 #else
63 #ifdef ALLOC_PERF_OPT 54 #ifdef ALLOC_PERF_OPT
64 void * OPJ_CALLCONV opj_malloc(size_t size); 55 void * OPJ_CALLCONV opj_malloc(size_t size);
65 #else 56 #else
66 /* prevent assertion on overflow for MSVC */ 57 /* prevent assertion on overflow for MSVC */
67 #ifdef _MSC_VER 58 #ifdef _MSC_VER
68 #define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size) ) 59 #define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size) )
69 #else 60 #else
70 #define opj_malloc(size) malloc(size) 61 #define opj_malloc(size) malloc(size)
71 #endif 62 #endif
72 #endif 63 #endif
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 */ 154 */
164 #ifdef ALLOC_PERF_OPT 155 #ifdef ALLOC_PERF_OPT
165 void * OPJ_CALLCONV opj_realloc(void * m, size_t s); 156 void * OPJ_CALLCONV opj_realloc(void * m, size_t s);
166 #else 157 #else
167 /* prevent assertion on overflow for MSVC */ 158 /* prevent assertion on overflow for MSVC */
168 #ifdef _MSC_VER 159 #ifdef _MSC_VER
169 #define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s)) 160 #define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s))
170 #else 161 #else
171 #define opj_realloc(m, s) realloc(m, s) 162 #define opj_realloc(m, s) realloc(m, s)
172 #endif 163 #endif
173 #endif
174 164
175 /** 165 /**
176 Deallocates or frees a memory block. 166 Deallocates or frees a memory block.
177 @param m Previously allocated memory block to be freed 167 @param m Previously allocated memory block to be freed
178 */ 168 */
179 #ifdef ALLOC_PERF_OPT 169 #ifdef ALLOC_PERF_OPT
180 void OPJ_CALLCONV opj_free(void * m); 170 void OPJ_CALLCONV opj_free(void * m);
181 #else 171 #else
182 #define opj_free(m) free(m) 172 #define opj_free(m) free(m)
183 #endif 173 #endif
184 174
185 #ifdef __GNUC__ 175 #ifdef __GNUC__
186 #pragma GCC poison malloc calloc realloc free 176 #pragma GCC poison malloc calloc realloc free
187 #endif 177 #endif
188 #endif 178 #endif
189 /* ----------------------------------------------------------------------- */ 179 /* ----------------------------------------------------------------------- */
190 /*@}*/ 180 /*@}*/
191 181
192 /*@}*/ 182 /*@}*/
193 183
194 #endif /* __OPJ_MALLOC_H */ 184 #endif /* __OPJ_MALLOC_H */
OLDNEW
« no previous file with comments | « core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c ('k') | core/src/fxcodec/lcms2/lcms2-2.6/src/cmserr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698