Skip to content
Snippets Groups Projects

various refactoring

Merged Vladimír Čunát requested to merge zonemd-misc into master
All threads resolved!
2 files
+ 13
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 12
3
@@ -21,6 +21,7 @@
#pragma once
#include <libknot/mm_ctx.h>
#include "contrib/ucw/mempool.h"
#include "lib/defines.h"
#include <assert.h>
#include <stdint.h>
@@ -55,6 +56,17 @@ void mm_ctx_mempool(knot_mm_t *mm, size_t chunk_size);
/* API in addition to Knot's mempattern. */
/*! \brief New memory pool context, allocated on itself. */
KR_EXPORT knot_mm_t * mm_ctx_mempool2(size_t chunk_size);
/*! \brief Delete a memory pool. OK to call on a non-pool. */
static inline void mm_ctx_delete(knot_mm_t *mm)
{
/* The mp_alloc comparison bears a risk of missing the private symbol from knot. */
if (mm && mm->ctx && mm->alloc == (knot_mm_alloc_t)mp_alloc)
mp_delete(mm->ctx);
}
/*! \brief Readability: avoid const-casts in code. */
static inline void free_const(const void *what)
{
@@ -78,6 +90,3 @@ static inline void mm_ctx_init_aligned(knot_mm_t *mm, size_t alignment)
}
}
/*! \brief New memory pool context, allocated on itself. */
KR_EXPORT knot_mm_t * mm_ctx_mempool2(size_t chunk_size);
Loading