-formatting

This commit is contained in:
Christian Grothoff
2013-03-31 17:02:07 +00:00
parent 61456e4b13
commit dbc57ff2f0
2 changed files with 31 additions and 12 deletions
+10 -1
View File
@@ -42,6 +42,11 @@
*/
#define ROUND_TO_ALIGN(n) ((n+(ALIGN_SIZE-1)) & (~(ALIGN_SIZE-1)))
/**
* Handle for a memory pool. Pools are not reentrant and must not be
* used by multiple threads.
*/
struct MemoryPool
{
@@ -71,6 +76,7 @@ struct MemoryPool
int is_mmap;
};
/**
* Create a memory pool.
*
@@ -110,6 +116,7 @@ MHD_pool_create (size_t max)
return pool;
}
/**
* Destroy a memory pool.
*/
@@ -125,6 +132,7 @@ MHD_pool_destroy (struct MemoryPool *pool)
free (pool);
}
/**
* Allocate size bytes from the pool.
* @return NULL if the pool cannot support size more
@@ -152,6 +160,7 @@ MHD_pool_allocate (struct MemoryPool *pool,
return ret;
}
/**
* Reallocate a block of memory obtained from the pool.
* This is particularly efficient when growing or
@@ -209,6 +218,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
return NULL;
}
/**
* Clear all entries from the memory pool except
* for "keep" of the given "size".
@@ -237,5 +247,4 @@ MHD_pool_reset (struct MemoryPool *pool,
}
/* end of memorypool.c */
+21 -11
View File
@@ -37,17 +37,22 @@
*/
struct MemoryPool;
/**
* Create a memory pool.
*
* @param max maximum size of the pool
*/
struct MemoryPool *MHD_pool_create (size_t max);
struct MemoryPool *
MHD_pool_create (size_t max);
/**
* Destroy a memory pool.
*/
void MHD_pool_destroy (struct MemoryPool *pool);
void
MHD_pool_destroy (struct MemoryPool *pool);
/**
* Allocate size bytes from the pool.
@@ -58,8 +63,10 @@ void MHD_pool_destroy (struct MemoryPool *pool);
* @return NULL if the pool cannot support size more
* bytes
*/
void *MHD_pool_allocate (struct MemoryPool *pool,
size_t size, int from_end);
void *
MHD_pool_allocate (struct MemoryPool *pool,
size_t size, int from_end);
/**
* Reallocate a block of memory obtained from the pool.
@@ -77,10 +84,12 @@ void *MHD_pool_allocate (struct MemoryPool *pool,
* NULL if the pool cannot support new_size
* bytes (old continues to be valid for old_size)
*/
void *MHD_pool_reallocate (struct MemoryPool *pool,
void *old,
size_t old_size,
size_t new_size);
void *
MHD_pool_reallocate (struct MemoryPool *pool,
void *old,
size_t old_size,
size_t new_size);
/**
* Clear all entries from the memory pool except
@@ -90,8 +99,9 @@ void *MHD_pool_reallocate (struct MemoryPool *pool,
* @param size how many bytes need to be kept at this address
* @return addr new address of "keep" (if it had to change)
*/
void *MHD_pool_reset (struct MemoryPool *pool,
void *keep,
size_t size);
void *
MHD_pool_reset (struct MemoryPool *pool,
void *keep,
size_t size);
#endif