diff options
| author | 3gg <3gg@shellblade.net> | 2026-04-05 15:00:07 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-04-05 15:00:07 -0700 |
| commit | c3f868d293a9b63a2bdc74dabdeaec9c4a0dfc5a (patch) | |
| tree | 5b5240bbe9bcaba67912085084a5aafab4f4b5a9 | |
| parent | 5458f3db7b08bf06c1f5c99a5851f6b270126b92 (diff) | |
Safer mempool_alloc
| -rw-r--r-- | mempool/include/mempool.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mempool/include/mempool.h b/mempool/include/mempool.h index 0de7ac6..ad25614 100644 --- a/mempool/include/mempool.h +++ b/mempool/include/mempool.h | |||
| @@ -69,7 +69,8 @@ | |||
| 69 | /// (default) or gracefully return null. Call mem_enable_traps() to toggle this | 69 | /// (default) or gracefully return null. Call mem_enable_traps() to toggle this |
| 70 | /// behaviour. | 70 | /// behaviour. |
| 71 | /// New blocks are conveniently zeroed out. | 71 | /// New blocks are conveniently zeroed out. |
| 72 | #define mempool_alloc(POOL) mempool_alloc_(&(POOL)->pool) | 72 | #define mempool_alloc(POOL) \ |
| 73 | (__typeof__((POOL)->object[0])*)mempool_alloc_(&(POOL)->pool) | ||
| 73 | 74 | ||
| 74 | /// Free the block. | 75 | /// Free the block. |
| 75 | /// The block pointer is conveniently set to null. | 76 | /// The block pointer is conveniently set to null. |
