aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/mem_pool.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libutil/mem_pool.h b/src/libutil/mem_pool.h
index a908af1ee..eea1c6358 100644
--- a/src/libutil/mem_pool.h
+++ b/src/libutil/mem_pool.h
@@ -153,7 +153,8 @@ void *rspamd_mempool_alloc_ (rspamd_mempool_t *pool, gsize size, const gchar *lo
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
#define rspamd_mempool_alloc(pool, size) \
rspamd_mempool_alloc_((pool), (size), (G_STRLOC))
-
+#define rspamd_mempool_alloc_type(pool, type) \
+ (type *)(rspamd_mempool_alloc_((pool), sizeof(type), (G_STRLOC)))
/**
* Notify external memory usage for memory pool
* @param pool
@@ -174,6 +175,8 @@ void *rspamd_mempool_alloc0_ (rspamd_mempool_t *pool, gsize size, const gchar *l
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
#define rspamd_mempool_alloc0(pool, size) \
rspamd_mempool_alloc0_((pool), (size), (G_STRLOC))
+#define rspamd_mempool_alloc0_type(pool, type) \
+ (type *)(rspamd_mempool_alloc0_((pool), sizeof(type), (G_STRLOC)))
/**
* Make a copy of string in pool