| OLD | NEW |
| 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 Loading... |
| 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 | |
| 54 #ifdef ALLOC_PERF_OPT | 53 #ifdef ALLOC_PERF_OPT |
| 55 void * OPJ_CALLCONV opj_malloc(size_t size); | 54 void * OPJ_CALLCONV opj_malloc(size_t size); |
| 56 #else | 55 #else |
| 57 /* prevent assertion on overflow for MSVC */ | 56 /* prevent assertion on overflow for MSVC */ |
| 58 #ifdef _MSC_VER | 57 #ifdef _MSC_VER |
| 59 #define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size)
) | 58 #define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size)
) |
| 60 #else | 59 #else |
| 61 #define opj_malloc(size) malloc(size) | 60 #define opj_malloc(size) malloc(size) |
| 62 #endif | 61 #endif |
| 63 #endif | 62 #endif |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 */ | 153 */ |
| 155 #ifdef ALLOC_PERF_OPT | 154 #ifdef ALLOC_PERF_OPT |
| 156 void * OPJ_CALLCONV opj_realloc(void * m, size_t s); | 155 void * OPJ_CALLCONV opj_realloc(void * m, size_t s); |
| 157 #else | 156 #else |
| 158 /* prevent assertion on overflow for MSVC */ | 157 /* prevent assertion on overflow for MSVC */ |
| 159 #ifdef _MSC_VER | 158 #ifdef _MSC_VER |
| 160 #define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s)) | 159 #define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s)) |
| 161 #else | 160 #else |
| 162 #define opj_realloc(m, s) realloc(m, s) | 161 #define opj_realloc(m, s) realloc(m, s) |
| 163 #endif | 162 #endif |
| 163 #endif |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 Deallocates or frees a memory block. | 166 Deallocates or frees a memory block. |
| 167 @param m Previously allocated memory block to be freed | 167 @param m Previously allocated memory block to be freed |
| 168 */ | 168 */ |
| 169 #ifdef ALLOC_PERF_OPT | 169 #ifdef ALLOC_PERF_OPT |
| 170 void OPJ_CALLCONV opj_free(void * m); | 170 void OPJ_CALLCONV opj_free(void * m); |
| 171 #else | 171 #else |
| 172 #define opj_free(m) free(m) | 172 #define opj_free(m) free(m) |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 #ifdef __GNUC__ | 175 #ifdef __GNUC__ |
| 176 #pragma GCC poison malloc calloc realloc free | 176 #pragma GCC poison malloc calloc realloc free |
| 177 #endif | 177 #endif |
| 178 #endif | 178 |
| 179 /* ----------------------------------------------------------------------- */ | 179 /* ----------------------------------------------------------------------- */ |
| 180 /*@}*/ | 180 /*@}*/ |
| 181 | 181 |
| 182 /*@}*/ | 182 /*@}*/ |
| 183 | 183 |
| 184 #endif /* __OPJ_MALLOC_H */ | 184 #endif /* __OPJ_MALLOC_H */ |
| 185 |
| OLD | NEW |