jabberd2  2.3.2
Data Structures | Macros | Typedefs | Functions
pool.h File Reference

Go to the source code of this file.

Data Structures

struct  pheap
 pheap - singular allocation of memory More...
 
struct  pfree
 pfree - a linked list node which stores an allocation chunk, plus a callback More...
 
struct  pool_struct
 pool - base node for a pool. More...
 

Macros

#define JABBERD2_API   extern
 
#define pool_heap(i)   _pool_new_heap(i,NULL,0)
 
#define pool_new()   _pool_new(NULL,0)
 

Typedefs

typedef void(* pool_cleanup_t )(void *arg)
 pool_cleanup_t - callback type which is associated with a pool entry; invoked when the pool entry is free'd More...
 
typedef struct pool_struct _pool
 pool - base node for a pool. More...
 
typedef struct pool_structpool_t
 

Functions

JABBERD2_API pool_t _pool_new (const char *file, int line)
 make an empty pool More...
 
JABBERD2_API pool_t _pool_new_heap (int size, const char *file, int line)
 
JABBERD2_API void * pmalloc (pool_t, int size)
 
JABBERD2_API void * pmalloc_x (pool_t p, int size, char c)
 
JABBERD2_API void * pmalloco (pool_t p, int size)
 easy safety utility (for creating blank mem for structs, etc) More...
 
JABBERD2_API char * pstrdup (pool_t p, const char *src)
 XXX efficient: move this to const char * and then loop throug the existing heaps to see if src is within a block in this pool. More...
 
JABBERD2_API char * pstrdupx (pool_t p, const char *src, int len)
 use given size More...
 
JABBERD2_API void pool_stat (int full)
 
JABBERD2_API void pool_cleanup (pool_t p, pool_cleanup_t fn, void *arg)
 public cleanup utils, insert in a way that they are run FIFO, before mem frees More...
 
JABBERD2_API void pool_free (pool_t p)
 
JABBERD2_API int pool_size (pool_t p)
 

Macro Definition Documentation

#define JABBERD2_API   extern

Definition at line 39 of file pool.h.

#define pool_heap (   i)    _pool_new_heap(i,NULL,0)

Definition at line 96 of file pool.h.

Referenced by xhash_new().

#define pool_new ( )    _pool_new(NULL,0)

Typedef Documentation

typedef void(* pool_cleanup_t)(void *arg)

pool_cleanup_t - callback type which is associated with a pool entry; invoked when the pool entry is free'd

Definition at line 53 of file pool.h.

typedef struct pool_struct _pool

pool - base node for a pool.

Maintains a linked list of pool entries (pfree)

typedef struct pool_struct * pool_t

Function Documentation

JABBERD2_API pool_t _pool_new ( const char *  file,
int  line 
)

make an empty pool

Definition at line 45 of file pool.c.

References _pool__malloc, pool_struct::cleanup, pool_struct::heap, pool_struct::size, xhash_new(), and xhash_put().

Referenced by _pool_new_heap().

JABBERD2_API pool_t _pool_new_heap ( int  size,
const char *  file,
int  line 
)

Definition at line 133 of file pool.c.

References _pool_heap(), _pool_new(), and pool_struct::heap.

JABBERD2_API void* pmalloc ( pool_t  ,
int  size 
)
JABBERD2_API void* pmalloc_x ( pool_t  p,
int  size,
char  c 
)

Definition at line 174 of file pool.c.

References pmalloc().

JABBERD2_API void* pmalloco ( pool_t  p,
int  size 
)
JABBERD2_API char* pstrdup ( pool_t  p,
const char *  src 
)
JABBERD2_API char* pstrdupx ( pool_t  p,
const char *  src,
int  len 
)
JABBERD2_API void pool_stat ( int  full)

Definition at line 285 of file pool.c.

Referenced by JABBER_MAIN().

JABBERD2_API void pool_cleanup ( pool_t  p,
pool_cleanup_t  fn,
void *  arg 
)
JABBERD2_API void pool_free ( pool_t  p)
JABBERD2_API int pool_size ( pool_t  p)

Definition at line 219 of file pool.c.

References pool_struct::size.