48
48
* first four bytes of the elements never contain the character string
49
49
* 'free'. use with care.*/
51
BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag);
52
void *BLI_mempool_alloc(BLI_mempool *pool);
53
void *BLI_mempool_calloc(BLI_mempool *pool);
54
void BLI_mempool_free(BLI_mempool *pool, void *addr);
55
void BLI_mempool_destroy(BLI_mempool *pool);
56
int BLI_mempool_count(BLI_mempool *pool);
57
void *BLI_mempool_findelem(BLI_mempool *pool, int index);
51
BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
53
__attribute__((warn_unused_result))
56
void *BLI_mempool_alloc(BLI_mempool *pool)
58
__attribute__((warn_unused_result))
59
__attribute__((nonnull(1)))
62
void *BLI_mempool_calloc(BLI_mempool *pool)
64
__attribute__((warn_unused_result))
65
__attribute__((nonnull(1)))
68
void BLI_mempool_free(BLI_mempool *pool, void *addr)
70
__attribute__((nonnull(1, 2)))
73
void BLI_mempool_destroy(BLI_mempool *pool)
75
__attribute__((nonnull(1)))
78
int BLI_mempool_count(BLI_mempool *pool)
80
__attribute__((nonnull(1)))
83
void *BLI_mempool_findelem(BLI_mempool *pool, int index)
85
__attribute__((warn_unused_result))
86
__attribute__((nonnull(1)))
89
void BLI_mempool_as_array(BLI_mempool *pool, void **data)
91
__attribute__((nonnull(1)))
95
void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
97
__attribute__((warn_unused_result))
98
__attribute__((nonnull(1, 2)))
59
102
/** iteration stuff. note: this may easy to produce bugs with **/
103
/* private structure */
61
104
typedef struct BLI_mempool_iter {
62
105
BLI_mempool *pool;
63
106
struct BLI_mempool_chunk *curchunk;
70
113
BLI_MEMPOOL_ALLOW_ITER = (1 << 1)
73
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
74
void *BLI_mempool_iterstep(BLI_mempool_iter *iter);
116
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
118
__attribute__((nonnull(1, 2)))
121
void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
123
__attribute__((warn_unused_result))
124
__attribute__((nonnull(1)))
76
128
#ifdef __cplusplus
132
#endif /* __BLI_MEMPOOL_H__ */