]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/mempool.c
Heap: Revert changes to HEAP_DELETE, which broke position tracking
[libucw.git] / ucw / mempool.c
index fe85a8c581b1f07b51a06519b5300e6e3b9a302e..521724a8b582accde6f68a649f793c0d5c05e6ba 100644 (file)
@@ -10,8 +10,8 @@
 
 #undef LOCAL_DEBUG
 
-#include "ucw/lib.h"
-#include "ucw/mempool.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
 
 #include <string.h>
 
@@ -26,7 +26,7 @@ struct mempool_chunk {
 static uns
 mp_align_size(uns size)
 {
-#ifdef POOL_IS_MMAP
+#ifdef CONFIG_UCW_POOL_IS_MMAP
   return ALIGN_TO(size + MP_CHUNK_TAIL, CPU_PAGE_SIZE) - MP_CHUNK_TAIL;
 #else
   return ALIGN_TO(size, CPU_STRUCT_ALIGN);
@@ -61,7 +61,7 @@ mp_free_big_chunk(struct mempool_chunk *chunk)
 static void *
 mp_new_chunk(uns size)
 {
-#ifdef POOL_IS_MMAP
+#ifdef CONFIG_UCW_POOL_IS_MMAP
   struct mempool_chunk *chunk;
   chunk = page_alloc(size + MP_CHUNK_TAIL) + size;
   chunk->size = size;
@@ -74,7 +74,7 @@ mp_new_chunk(uns size)
 static void
 mp_free_chunk(struct mempool_chunk *chunk)
 {
-#ifdef POOL_IS_MMAP
+#ifdef CONFIG_UCW_POOL_IS_MMAP
   page_free((void *)chunk - chunk->size, chunk->size + MP_CHUNK_TAIL);
 #else
   mp_free_big_chunk(chunk);
@@ -344,13 +344,12 @@ void
 mp_pop(struct mempool *pool)
 {
   ASSERT(pool->state.next);
-  struct mempool_state state = pool->state;
-  mp_restore(pool, &state);
+  mp_restore(pool, pool->state.next);
 }
 
 #ifdef TEST
 
-#include "ucw/getopt.h"
+#include <ucw/getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>