jabberd2
2.6.1
|
Go to the source code of this file.
Macros | |
#define | _pool__malloc malloc |
#define | _pool__free free |
Functions | |
pool_t | _pool_new (const char *zone, int line) |
make an empty pool More... | |
static void | _pool_heap_free (void *arg) |
free a heap More... | |
static void | _pool_cleanup_append (pool_t p, struct pfree *pf) |
mem should always be freed last More... | |
static struct pfree * | _pool_free (pool_t p, pool_cleanup_t f, void *arg) |
create a cleanup tracker More... | |
static struct pheap * | _pool_heap (pool_t p, int size) |
create a heap and make sure it get's cleaned up More... | |
pool_t | _pool_new_heap (int size, const char *zone, int line) |
void * | pmalloc (pool_t p, int size) |
void * | pmalloc_x (pool_t p, int size, char c) |
void * | pmalloco (pool_t p, int size) |
easy safety utility (for creating blank mem for structs, etc) More... | |
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... | |
char * | pstrdupx (pool_t p, const char *src, int len) |
use given size More... | |
int | pool_size (pool_t p) |
void | pool_free (pool_t p) |
void | pool_cleanup (pool_t p, pool_cleanup_t f, void *arg) |
public cleanup utils, insert in a way that they are run FIFO, before mem frees More... | |
void | pool_stat (int full) |
#define _pool__malloc malloc |
Definition at line 39 of file pool.c.
Referenced by _pool_free(), _pool_heap(), _pool_new(), and pmalloc().
#define _pool__free free |
Definition at line 40 of file pool.c.
Referenced by _pool_heap_free(), pmalloc(), and pool_free().
pool_t _pool_new | ( | const char * | zone, |
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().
|
static |
free a heap
Definition at line 72 of file pool.c.
References _pool__free, and pheap::block.
Referenced by _pool_heap().
mem should always be freed last
Definition at line 81 of file pool.c.
References pool_struct::cleanup, pool_struct::cleanup_tail, and pfree::next.
Referenced by _pool_heap(), and pmalloc().
|
static |
create a cleanup tracker
Definition at line 99 of file pool.c.
References _pool__malloc, pfree::arg, pfree::f, and pfree::next.
Referenced by _pool_heap(), pmalloc(), and pool_cleanup().
create a heap and make sure it get's cleaned up
Definition at line 113 of file pool.c.
References _pool__malloc, _pool_cleanup_append(), _pool_free(), _pool_heap_free(), pheap::block, pfree::heap, pheap::size, pool_struct::size, and pheap::used.
Referenced by _pool_new_heap(), and pmalloc().
pool_t _pool_new_heap | ( | int | size, |
const char * | zone, | ||
int | line | ||
) |
Definition at line 133 of file pool.c.
References _pool_heap(), _pool_new(), and pool_struct::heap.
void* pmalloc | ( | pool_t | p, |
int | size | ||
) |
Definition at line 141 of file pool.c.
References _pool__free, _pool__malloc, _pool_cleanup_append(), _pool_free(), _pool_heap(), pheap::block, pool_struct::heap, pheap::size, pool_struct::size, and pheap::used.
Referenced by _c2s_client_sx_callback(), _dns_add_host(), _dns_add_result(), _spool_add(), config_load_with_id(), jqueue_push(), pmalloc_x(), pmalloco(), pqueue_push(), pstrdup(), pstrdupx(), s2s_route_key(), spool_new(), spool_print(), strescape(), and strunescape().
void* pmalloc_x | ( | pool_t | p, |
int | size, | ||
char | c | ||
) |
void* pmalloco | ( | pool_t | p, |
int | size | ||
) |
easy safety utility (for creating blank mem for structs, etc)
Definition at line 183 of file pool.c.
References pmalloc().
Referenced by _c2s_config_expand(), _c2s_hosts_expand(), _privacy_in_sess(), _privacy_user_load(), _s2s_hosts_expand(), _template_roster_reload(), _user_alloc(), _xdata_field_parse(), _xhash_node_new(), authreg_init(), config_load_with_id(), JABBER_MAIN(), jqueue_new(), pqueue_new(), sess_start(), xdata_field_new(), xdata_item_new(), xdata_new(), xdata_option_new(), xdata_parse(), and xhash_new().
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.
Definition at line 191 of file pool.c.
References pmalloc().
Referenced by _c2s_client_accept_check(), _c2s_client_sx_callback(), _c2s_component_presence(), _c2s_config_expand(), _c2s_hosts_expand(), _config_expandx(), _dns_add_host(), _dns_add_result(), _in_result(), _out_result(), _out_verify(), _privacy_in_sess(), _privacy_user_load(), _router_accept_check(), _router_process_bind(), _router_sx_callback(), _s2s_hosts_expand(), _sm_hosts_expand(), aci_load(), config_load_with_id(), feature_register(), in_mio_callback(), JABBER_MAIN(), nad_free(), nad_new(), out_route(), s2s_db_key(), sm_register_ns(), sm_storage_rate_limit(), spool_add(), xdata_field_new(), and xdata_new().
char* pstrdupx | ( | pool_t | p, |
const char * | src, | ||
int | len | ||
) |
use given size
Definition at line 205 of file pool.c.
References pmalloc().
Referenced by _disco_pkt_sm_populate(), _iq_private_in_sess(), _out_dialback(), _privacy_in_sess(), _template_roster_reload(), _xdata_field_parse(), config_load_with_id(), module_init(), out_route(), user_table_load(), xdata_add_value(), xdata_option_new(), and xdata_parse().
int pool_size | ( | pool_t | p | ) |
Definition at line 219 of file pool.c.
References pool_struct::size.
void pool_free | ( | pool_t | p | ) |
Definition at line 226 of file pool.c.
References _pool__free, pfree::arg, pool_struct::cleanup, pfree::f, pfree::next, and xhash_zap().
Referenced by _privacy_free_z(), _privacy_in_sess(), _sx_websocket_free(), jqueue_free(), sess_end(), sess_start(), user_free(), user_load(), xdata_parse(), and xhash_free().
void pool_cleanup | ( | pool_t | p, |
pool_cleanup_t | f, | ||
void * | arg | ||
) |
public cleanup utils, insert in a way that they are run FIFO, before mem frees
Definition at line 251 of file pool.c.
References _pool_free(), pfree::arg, pool_struct::cleanup, pfree::next, pool_stat(), pool_struct::size, and xhash_walk().
Referenced by _c2s_client_accept_check(), _iq_private_in_sess(), _privacy_in_sess(), _privacy_user_load(), _roster_user_load(), _template_roster_reload(), _user_alloc(), _vacation_user_load(), _verify_user_load(), sess_start(), sm_storage_rate_limit(), and xdata_add_value().
void pool_stat | ( | int | full | ) |
Definition at line 285 of file pool.c.
Referenced by JABBER_MAIN(), and pool_cleanup().