ctrump/common/mempool.c File Reference

simple memory allocator module. More...

#include "mempool.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

Include dependency graph for mempool.c:

Go to the source code of this file.

Functions

void ctrump_mempool_init (struct ctrump_mempool *pool, unsigned int size_hint)
 create mempool
void ctrump_mempool_destroy (struct ctrump_mempool *pool)
 delete mempool
void * ctrump_mempool_alloc_align (struct ctrump_mempool *pool, unsigned int align_shift, unsigned int size)
 allocate memory from pool. memory is aligend to `2^align'.
char * ctrump_mempool_strdup (struct ctrump_mempool *p, char *str)


Detailed Description

simple memory allocator module.

Definition in file mempool.c.


Function Documentation

void* ctrump_mempool_alloc_align ( struct ctrump_mempool p,
unsigned int  align_shift,
unsigned int  size 
)

allocate memory from pool. memory is aligend to `2^align'.

Parameters:
p pool object
align_shift align
size object size
Returns:
allocated memory

Definition at line 67 of file mempool.c.

References ctrump_mempool::data_entry, ctrump_mempool::entry_byte_pos, ctrump_mempool::entry_byte_remain, ctrump_mempool::entry_byte_size, ctrump_mempool::entry_index, and ctrump_mempool::entry_num.

Referenced by ctrump_intern().

void ctrump_mempool_destroy ( struct ctrump_mempool pool  ) 

void ctrump_mempool_init ( struct ctrump_mempool pool,
unsigned int  size_hint 
)

char* ctrump_mempool_strdup ( struct ctrump_mempool p,
char *  str 
)

Definition at line 121 of file mempool.c.

References ctrump_mempool_alloc.


Generated on Tue Mar 31 20:19:24 2009 for ctrump by  doxygen 1.5.6