summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-30 14:36:24 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-30 14:36:24 -0400
commit2edfa06a011307c9e3b8aa6b84c418cb70c0ec7c (patch)
treedeb94a20a3e0fd2e35f311a50cc29837b3eb4429 /libdimension
parent33addf7dd8d2ff29c0462705c9af3903b1a3ab1c (diff)
downloaddimension-2edfa06a011307c9e3b8aa6b84c418cb70c0ec7c.tar.xz
pool: Rename pool_alloc to palloc.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/dimension/pool.h4
-rw-r--r--libdimension/pool.c2
-rw-r--r--libdimension/tests/pool.c12
3 files changed, 9 insertions, 9 deletions
diff --git a/libdimension/dimension/pool.h b/libdimension/dimension/pool.h
index 9b6574a..33f1dd7 100644
--- a/libdimension/dimension/pool.h
+++ b/libdimension/dimension/pool.h
@@ -43,7 +43,7 @@ dmnsn_pool *dmnsn_new_pool(void);
* @param[in] callback An optional callback to invoke before the memory is freed.
* @return The allocated memory area.
*/
-void *dmnsn_pool_alloc(dmnsn_pool *pool, size_t size, dmnsn_callback_fn *callback);
+void *dmnsn_palloc(dmnsn_pool *pool, size_t size, dmnsn_callback_fn *callback);
/**
* Allocate some memory from a pool.
@@ -51,7 +51,7 @@ void *dmnsn_pool_alloc(dmnsn_pool *pool, size_t size, dmnsn_callback_fn *callbac
* @param[in] type The type of the memory block to allocate.
* @return The allocated memory area.
*/
-#define DMNSN_POOL_ALLOC(pool, type) ((type *)dmnsn_pool_alloc((pool), sizeof(type), NULL))
+#define DMNSN_PALLOC(pool, type) ((type *)dmnsn_palloc((pool), sizeof(type), NULL))
/**
* Free a memory pool and all associated allocations.
diff --git a/libdimension/pool.c b/libdimension/pool.c
index 57c357a..a0db161 100644
--- a/libdimension/pool.c
+++ b/libdimension/pool.c
@@ -66,7 +66,7 @@ dmnsn_new_pool(void)
}
void *
-dmnsn_pool_alloc(dmnsn_pool *pool, size_t size, dmnsn_callback_fn *callback)
+dmnsn_palloc(dmnsn_pool *pool, size_t size, dmnsn_callback_fn *callback)
{
dmnsn_pool_block *old_block = pthread_getspecific(pool->thread_block);
diff --git a/libdimension/tests/pool.c b/libdimension/tests/pool.c
index 68ecfae..e135ce4 100644
--- a/libdimension/tests/pool.c
+++ b/libdimension/tests/pool.c
@@ -42,7 +42,7 @@ DMNSN_TEST_TEARDOWN(pool)
DMNSN_TEST(pool, simple)
{
for (int i = 0; i < 10000; ++i) {
- int *p = DMNSN_POOL_ALLOC(pool, int);
+ int *p = DMNSN_PALLOC(pool, int);
*p = i;
}
@@ -59,10 +59,10 @@ callback(void *ptr)
DMNSN_TEST(pool, callback)
{
- dmnsn_pool_alloc(pool, sizeof(int), NULL);
- dmnsn_pool_alloc(pool, sizeof(int), callback);
- dmnsn_pool_alloc(pool, sizeof(int), callback);
- dmnsn_pool_alloc(pool, sizeof(int), NULL);
+ dmnsn_palloc(pool, sizeof(int), NULL);
+ dmnsn_palloc(pool, sizeof(int), callback);
+ dmnsn_palloc(pool, sizeof(int), callback);
+ dmnsn_palloc(pool, sizeof(int), NULL);
dmnsn_delete_pool(pool);
pool = NULL;
@@ -74,7 +74,7 @@ static int
alloc_thread(void *ptr, unsigned int thread, unsigned int nthreads)
{
for (unsigned int i = thread; i < 10000; i += nthreads) {
- int *p = DMNSN_POOL_ALLOC(pool, int);
+ int *p = DMNSN_PALLOC(pool, int);
*p = i;
}
return 0;