diff options
Diffstat (limited to 'source/blender/blenlib/BLI_mempool.h')
-rw-r--r-- | source/blender/blenlib/BLI_mempool.h | 105 |
1 files changed, 17 insertions, 88 deletions
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 153a3735182..88650719712 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -39,6 +39,8 @@ extern "C" { #endif +#include "BLI_compiler_attrs.h" + struct BLI_mempool; struct BLI_mempool_chunk; @@ -49,85 +51,21 @@ typedef struct BLI_mempool BLI_mempool; * 'free'. use with care.*/ BLI_mempool *BLI_mempool_create(unsigned int esize, unsigned int totelem, - unsigned int pchunk, unsigned int flag) -#ifdef __GNUC__ -__attribute__((malloc)) -__attribute__((warn_unused_result)) -#endif -; -void *BLI_mempool_alloc(BLI_mempool *pool) -#ifdef __GNUC__ -__attribute__((malloc)) -__attribute__((warn_unused_result)) -__attribute__((nonnull(1))) -#endif -; -void *BLI_mempool_calloc(BLI_mempool *pool) -#ifdef __GNUC__ -__attribute__((malloc)) -__attribute__((warn_unused_result)) -__attribute__((nonnull(1))) -#endif -; -void BLI_mempool_free(BLI_mempool *pool, void *addr) -#ifdef __GNUC__ -__attribute__((nonnull(1, 2))) -#endif -; + unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +void *BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +void *BLI_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2); void BLI_mempool_clear_ex(BLI_mempool *pool, - const int totelem_reserve) -#ifdef __GNUC__ -__attribute__((nonnull(1))) -#endif -; -void BLI_mempool_clear(BLI_mempool *pool) -#ifdef __GNUC__ -__attribute__((nonnull(1))) -#endif -; -void BLI_mempool_destroy(BLI_mempool *pool) -#ifdef __GNUC__ -__attribute__((nonnull(1))) -#endif -; -int BLI_mempool_count(BLI_mempool *pool) -#ifdef __GNUC__ -__attribute__((nonnull(1))) -#endif -; -void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) -#ifdef __GNUC__ -__attribute__((warn_unused_result)) -__attribute__((nonnull(1))) -#endif -; -void BLI_mempool_as_table(BLI_mempool *pool, void **data) -#ifdef __GNUC__ -__attribute__((nonnull(1, 2))) -#endif -; + const int totelem_reserve) ATTR_NONNULL(1); +void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1); +void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1); +int BLI_mempool_count(BLI_mempool *pool) ATTR_NONNULL(1); +void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); -void **BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) -#ifdef __GNUC__ -__attribute__((malloc)) -__attribute__((warn_unused_result)) -__attribute__((nonnull(1, 2))) -#endif -; - -void BLI_mempool_as_array(BLI_mempool *pool, void *data) -#ifdef __GNUC__ -__attribute__((nonnull(1, 2))) -#endif -; - -void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) -#ifdef __GNUC__ -__attribute__((malloc)) -__attribute__((warn_unused_result)) -__attribute__((nonnull(1, 2))) -#endif -; +void BLI_mempool_as_table(BLI_mempool *pool, void **data) ATTR_NONNULL(1, 2); +void **BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); +void BLI_mempool_as_array(BLI_mempool *pool, void *data) ATTR_NONNULL(1, 2); +void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); /** iteration stuff. note: this may easy to produce bugs with **/ /* private structure */ @@ -143,17 +81,8 @@ enum { BLI_MEMPOOL_ALLOW_ITER = (1 << 1) }; -void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) -#ifdef __GNUC__ -__attribute__((nonnull(1, 2))) -#endif -; -void *BLI_mempool_iterstep(BLI_mempool_iter *iter) -#ifdef __GNUC__ -__attribute__((warn_unused_result)) -__attribute__((nonnull(1))) -#endif -; +void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL(); +void *BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #ifdef __cplusplus } |