Blender  V3.3
BLI_mempool.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
4 #pragma once
5 
10 #include "BLI_compiler_attrs.h"
11 #include "BLI_utildefines.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 struct BLI_mempool;
18 struct BLI_mempool_chunk;
19 
20 typedef struct BLI_mempool BLI_mempool;
21 
23  unsigned int elem_num,
24  unsigned int pchunk,
25  unsigned int flag)
28  ATTR_NONNULL(1);
36 void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
43 void BLI_mempool_clear_ex(BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1);
54  ATTR_NONNULL(1);
55 
68  const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
69  ATTR_NONNULL(1, 2);
78  const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
79  ATTR_NONNULL(1, 2);
80 
81 #ifndef NDEBUG
83 #endif
84 
91 typedef struct BLI_mempool_iter {
94  unsigned int curindex;
96 
98 enum {
108 };
109 
118 
119 #ifdef __cplusplus
120 }
121 #endif
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_MALLOC
#define ATTR_RETURNS_NONNULL
#define ATTR_NONNULL(...)
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
Definition: BLI_mempool.c:498
@ BLI_MEMPOOL_ALLOW_ITER
Definition: BLI_mempool.h:107
@ BLI_MEMPOOL_NOP
Definition: BLI_mempool.h:99
void * BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_mempool.c:577
void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1
int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:434
void void BLI_mempool_clear_ex(BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1)
Definition: BLI_mempool.c:650
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
Definition: BLI_mempool.c:253
void void void void void BLI_mempool_set_memory_debug(void)
Definition: BLI_mempool.c:719
void void void void * BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_mempool_as_table(BLI_mempool *pool, void **data) ATTR_NONNULL(1
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
Definition: BLI_mempool.c:319
struct BLI_mempool_iter BLI_mempool_iter
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:707
void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:702
void * BLI_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
Definition: BLI_mempool.c:347
void * BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_mempool.c:439
void void void BLI_mempool_as_array(BLI_mempool *pool, void *data) ATTR_NONNULL(1
void void ** BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
struct BLI_mempool_chunk * curchunk
Definition: BLI_mempool.h:93
BLI_mempool * pool
Definition: BLI_mempool.h:92
unsigned int curindex
Definition: BLI_mempool.h:94