Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-05-13 16:57:03 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-14 11:57:03 +0300
commite5349f14eb17689316ab5a85a7d4ffbb740ec93c (patch)
tree3ad2b81b1db82c932c67f2bf573265e772be1520 /source/blender/blenlib/BLI_memblock.h
parent0e5da91f0aa534c3dfdb6a650cfb067fa84099da (diff)
BLI_memblock: Add more options
- Use int instead of uint for safety and less conversions. - Add free callback - Add cleared alloc option
Diffstat (limited to 'source/blender/blenlib/BLI_memblock.h')
-rw-r--r--source/blender/blenlib/BLI_memblock.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_memblock.h b/source/blender/blenlib/BLI_memblock.h
index 375cb22c415..81dd2100362 100644
--- a/source/blender/blenlib/BLI_memblock.h
+++ b/source/blender/blenlib/BLI_memblock.h
@@ -33,16 +33,18 @@ extern "C" {
struct BLI_memblock;
typedef struct BLI_memblock BLI_memblock;
+typedef void (*MemblockValFreeFP)(void *val);
-BLI_memblock *BLI_memblock_create(uint elem_size) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
+BLI_memblock *BLI_memblock_create(uint elem_size,
+ const bool clear_alloc) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void *BLI_memblock_alloc(BLI_memblock *mblk) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
-void BLI_memblock_clear(BLI_memblock *mblk) ATTR_NONNULL(1);
-void BLI_memblock_destroy(BLI_memblock *mblk) ATTR_NONNULL(1);
+void BLI_memblock_clear(BLI_memblock *mblk, MemblockValFreeFP valfreefp) ATTR_NONNULL(1);
+void BLI_memblock_destroy(BLI_memblock *mblk, MemblockValFreeFP free_callback) ATTR_NONNULL(1);
typedef struct BLI_memblock_iter {
BLI_memblock *mblk;
- uint current_index;
- uint elem_per_chunk;
+ int current_index;
+ int elem_per_chunk;
} BLI_memblock_iter;
void BLI_memblock_iternew(BLI_memblock *pool, BLI_memblock_iter *iter) ATTR_NONNULL();