NetSurf
|
Go to the source code of this file.
Data Structures | |
struct | talloc_reference_handle |
struct | talloc_chunk |
Macros | |
#define | STANDALONE |
#define | ALWAYS_REALLOC 0 |
#define | MAX_TALLOC_SIZE 0x10000000 |
#define | TALLOC_MAGIC 0xe814ec70 |
#define | TALLOC_FLAG_FREE 0x01 |
#define | TALLOC_FLAG_LOOP 0x02 |
#define | TALLOC_MAGIC_REFERENCE ((const char *)1) |
#define | TALLOC_ABORT(reason) abort() |
#define | discard_const_p(type, ptr) ((type *)(ptr)) |
#define | likely(x) x |
#define | unlikely(x) x |
#define | TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) |
#define | TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc)) |
#define | _TLIST_ADD(list, p) |
#define | _TLIST_REMOVE(list, p) |
#define | va_copy(dest, src) (dest) = (src) |
Typedefs | |
typedef int(* | talloc_destructor_t) (void *) |
Functions | |
static struct talloc_chunk * | talloc_chunk_from_ptr (const void *ptr) |
static struct talloc_chunk * | talloc_parent_chunk (const void *ptr) |
void * | talloc_parent (const void *ptr) |
const char * | talloc_parent_name (const void *ptr) |
static void * | __talloc (const void *context, size_t size) |
void | _talloc_set_destructor (const void *ptr, int(*destructor)(void *)) |
int | talloc_increase_ref_count (const void *ptr) |
static int | talloc_reference_destructor (struct talloc_reference_handle *handle) |
static void | _talloc_set_name_const (const void *ptr, const char *name) |
static void * | _talloc_named_const (const void *context, size_t size, const char *name) |
void * | _talloc_reference (const void *context, const void *ptr) |
static int | _talloc_free (void *ptr) |
void * | _talloc_steal (const void *new_ctx, const void *ptr) |
static int | talloc_unreference (const void *context, const void *ptr) |
int | talloc_unlink (const void *context, void *ptr) |
static const char * | talloc_set_name_v (const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2 |
const char * | talloc_set_name (const void *ptr, const char *fmt,...) |
void * | talloc_named (const void *context, size_t size, const char *fmt,...) |
const char * | talloc_get_name (const void *ptr) |
void * | talloc_check_name (const void *ptr, const char *name) |
void * | talloc_init (const char *fmt,...) |
void | talloc_free_children (void *ptr) |
void * | _talloc (const void *context, size_t size) |
void | talloc_set_name_const (const void *ptr, const char *name) |
void * | talloc_named_const (const void *context, size_t size, const char *name) |
int | talloc_free (void *ptr) |
void * | _talloc_realloc (const void *context, void *ptr, size_t size, const char *name) |
void * | _talloc_move (const void *new_ctx, const void *_pptr) |
size_t | talloc_total_size (const void *ptr) |
size_t | talloc_total_blocks (const void *ptr) |
size_t | talloc_reference_count (const void *ptr) |
void | talloc_report_depth_cb (const void *ptr, int depth, int max_depth, void(*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data) |
static void | talloc_report_depth_FILE_helper (const void *ptr, int depth, int max_depth, int is_ref, void *_f) |
void | talloc_report_depth_file (const void *ptr, int depth, int max_depth, FILE *f) |
void | talloc_report_full (const void *ptr, FILE *f) |
void | talloc_report (const void *ptr, FILE *f) |
static void | talloc_report_null (void) |
static void | talloc_report_null_full (void) |
void | talloc_enable_null_tracking (void) |
void | talloc_disable_null_tracking (void) |
void | talloc_enable_leak_report (void) |
void | talloc_enable_leak_report_full (void) |
void * | _talloc_zero (const void *ctx, size_t size, const char *name) |
void * | _talloc_memdup (const void *t, const void *p, size_t size, const char *name) |
char * | talloc_strdup (const void *t, const char *p) |
char * | talloc_append_string (const void *t, char *orig, const char *append) |
char * | talloc_strndup (const void *t, const char *p, size_t n) |
char * | talloc_vasprintf (const void *t, const char *fmt, va_list ap) |
char * | talloc_asprintf (const void *t, const char *fmt,...) |
char * | talloc_vasprintf_append (char *s, const char *fmt, va_list ap) |
Realloc s to append the formatted result of fmt and ap , and return s , which may have moved. More... | |
char * | talloc_asprintf_append (char *s, const char *fmt,...) |
void * | _talloc_array (const void *ctx, size_t el_size, unsigned count, const char *name) |
void * | _talloc_zero_array (const void *ctx, size_t el_size, unsigned count, const char *name) |
void * | _talloc_realloc_array (const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name) |
void * | talloc_realloc_fn (const void *context, void *ptr, size_t size) |
static int | talloc_autofree_destructor (void *ptr) |
static void | talloc_autofree (void) |
void * | talloc_autofree_context (void) |
size_t | talloc_get_size (const void *context) |
void * | talloc_find_parent_byname (const void *context, const char *name) |
void | talloc_show_parents (const void *context, FILE *file) |
int | talloc_is_parent (const void *context, const void *ptr) |
Variables | |
static void * | null_context |
static void * | autofree_context |
#define _TLIST_ADD | ( | list, | |
p | |||
) |
#define _TLIST_REMOVE | ( | list, | |
p | |||
) |
#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) |
#define TC_PTR_FROM_CHUNK | ( | tc | ) | ((void *)(TC_HDR_SIZE + (char*)tc)) |
|
inlinestatic |
Definition at line 209 of file talloc.c.
References talloc_chunk::child, talloc_chunk::destructor, talloc_chunk::flags, likely, MAX_TALLOC_SIZE, talloc_chunk::name, talloc_chunk::next, null_context, parent, talloc_chunk::parent, talloc_chunk::prev, talloc_chunk::refs, talloc_chunk::size, talloc_chunk_from_ptr(), TALLOC_MAGIC, TC_HDR_SIZE, TC_PTR_FROM_CHUNK, and unlikely.
Referenced by _talloc(), _talloc_named_const(), talloc_init(), talloc_named(), talloc_strndup(), and talloc_vasprintf().
void * _talloc | ( | const void * | context, |
size_t | size | ||
) |
Definition at line 729 of file talloc.c.
References __talloc(), and talloc_chunk::size.
void * _talloc_array | ( | const void * | ctx, |
size_t | el_size, | ||
unsigned | count, | ||
const char * | name | ||
) |
Definition at line 1289 of file talloc.c.
References _talloc_named_const(), count(), MAX_TALLOC_SIZE, and talloc_chunk::name.
|
inlinestatic |
Definition at line 347 of file talloc.c.
References _talloc_free(), _TLIST_REMOVE, talloc_chunk::child, talloc_chunk::destructor, talloc_chunk::flags, talloc_chunk::next, null_context, talloc_chunk::parent, talloc_chunk::prev, talloc_chunk::refs, talloc_chunk_from_ptr(), TALLOC_FLAG_FREE, TALLOC_FLAG_LOOP, talloc_is_parent(), talloc_parent_chunk(), talloc_steal, TC_PTR_FROM_CHUNK, and unlikely.
Referenced by _talloc_free(), _talloc_realloc(), talloc_autofree(), talloc_disable_null_tracking(), talloc_free(), talloc_free_children(), talloc_init(), talloc_named(), talloc_unlink(), and talloc_unreference().
void * _talloc_memdup | ( | const void * | t, |
const void * | p, | ||
size_t | size, | ||
const char * | name | ||
) |
Definition at line 1104 of file talloc.c.
References _talloc_named_const(), and likely.
void * _talloc_move | ( | const void * | new_ctx, |
const void * | _pptr | ||
) |
Definition at line 841 of file talloc.c.
References _talloc_steal(), and discard_const_p.
|
inlinestatic |
Definition at line 299 of file talloc.c.
References __talloc(), _talloc_set_name_const(), talloc_chunk::name, talloc_chunk::size, and unlikely.
Referenced by _talloc_array(), _talloc_memdup(), _talloc_realloc(), _talloc_reference(), _talloc_zero(), talloc_autofree_context(), talloc_enable_null_tracking(), and talloc_named_const().
void * _talloc_realloc | ( | const void * | context, |
void * | ptr, | ||
size_t | size, | ||
const char * | name | ||
) |
Definition at line 771 of file talloc.c.
References _talloc_free(), _talloc_named_const(), _talloc_set_name_const(), talloc_chunk::child, talloc_chunk::flags, MAX_TALLOC_SIZE, talloc_chunk::name, talloc_chunk::next, talloc_chunk::parent, talloc_chunk::prev, talloc_chunk::refs, talloc_chunk::size, talloc_chunk_from_ptr(), TALLOC_FLAG_FREE, TC_HDR_SIZE, TC_PTR_FROM_CHUNK, and unlikely.
Referenced by _talloc_realloc_array(), and talloc_realloc_fn().
void * _talloc_realloc_array | ( | const void * | ctx, |
void * | ptr, | ||
size_t | el_size, | ||
unsigned | count, | ||
const char * | name | ||
) |
Definition at line 1311 of file talloc.c.
References _talloc_realloc(), count(), MAX_TALLOC_SIZE, and talloc_chunk::name.
void * _talloc_reference | ( | const void * | context, |
const void * | ptr | ||
) |
Definition at line 322 of file talloc.c.
References _talloc_named_const(), _TLIST_ADD, discard_const_p, talloc_reference_handle::ptr, talloc_chunk::refs, talloc_chunk_from_ptr(), TALLOC_MAGIC_REFERENCE, talloc_reference_destructor(), talloc_set_destructor, and unlikely.
void _talloc_set_destructor | ( | const void * | ptr, |
int(*)(void *) | destructor | ||
) |
Definition at line 257 of file talloc.c.
References talloc_chunk::destructor, and talloc_chunk_from_ptr().
|
inlinestatic |
Definition at line 290 of file talloc.c.
References talloc_chunk::name, and talloc_chunk_from_ptr().
Referenced by _talloc_named_const(), _talloc_realloc(), talloc_append_string(), talloc_set_name_const(), talloc_set_name_v(), talloc_strdup(), talloc_strndup(), talloc_vasprintf(), and talloc_vasprintf_append().
void * _talloc_steal | ( | const void * | new_ctx, |
const void * | ptr | ||
) |
Definition at line 435 of file talloc.c.
References _TLIST_ADD, _TLIST_REMOVE, talloc_chunk::child, discard_const_p, talloc_chunk::next, null_context, talloc_chunk::parent, talloc_chunk::prev, talloc_chunk_from_ptr(), and unlikely.
Referenced by _talloc_move().
void * _talloc_zero | ( | const void * | ctx, |
size_t | size, | ||
const char * | name | ||
) |
Definition at line 1090 of file talloc.c.
References _talloc_named_const().
Referenced by _talloc_zero_array().
void * _talloc_zero_array | ( | const void * | ctx, |
size_t | el_size, | ||
unsigned | count, | ||
const char * | name | ||
) |
Definition at line 1300 of file talloc.c.
References _talloc_zero(), count(), MAX_TALLOC_SIZE, and talloc_chunk::name.
char * talloc_append_string | ( | const void * | t, |
char * | orig, | ||
const char * | append | ||
) |
Definition at line 1134 of file talloc.c.
References _talloc_set_name_const(), and talloc_realloc.
char * talloc_asprintf | ( | const void * | t, |
const char * | fmt, | ||
... | |||
) |
Definition at line 1214 of file talloc.c.
References talloc_vasprintf().
char * talloc_asprintf_append | ( | char * | s, |
const char * | fmt, | ||
... | |||
) |
Definition at line 1276 of file talloc.c.
References talloc_vasprintf_append().
|
static |
Definition at line 1336 of file talloc.c.
References _talloc_free(), and autofree_context.
Referenced by talloc_autofree_context().
void * talloc_autofree_context | ( | void | ) |
Definition at line 1345 of file talloc.c.
References _talloc_named_const(), autofree_context, talloc_autofree(), talloc_autofree_destructor(), and talloc_set_destructor.
|
static |
Definition at line 1330 of file talloc.c.
References autofree_context.
Referenced by talloc_autofree_context().
void * talloc_check_name | ( | const void * | ptr, |
const char * | name | ||
) |
Definition at line 646 of file talloc.c.
References discard_const_p, likely, talloc_chunk::name, talloc_get_name(), and unlikely.
|
inlinestatic |
Definition at line 132 of file talloc.c.
References discard_const_p, talloc_chunk::flags, TALLOC_ABORT, TALLOC_FLAG_FREE, TALLOC_MAGIC, TC_HDR_SIZE, and unlikely.
Referenced by __talloc(), _talloc_free(), _talloc_realloc(), _talloc_reference(), _talloc_set_destructor(), _talloc_set_name_const(), _talloc_steal(), talloc_find_parent_byname(), talloc_free_children(), talloc_get_name(), talloc_get_size(), talloc_is_parent(), talloc_parent_chunk(), talloc_reference_count(), talloc_reference_destructor(), talloc_report_depth_cb(), talloc_set_name_v(), talloc_show_parents(), talloc_total_blocks(), talloc_total_size(), talloc_unlink(), talloc_unreference(), and talloc_vasprintf_append().
void talloc_disable_null_tracking | ( | void | ) |
Definition at line 1063 of file talloc.c.
References _talloc_free(), and null_context.
void talloc_enable_leak_report | ( | void | ) |
Definition at line 1072 of file talloc.c.
References talloc_enable_null_tracking(), and talloc_report_null().
void talloc_enable_leak_report_full | ( | void | ) |
Definition at line 1081 of file talloc.c.
References talloc_enable_null_tracking(), and talloc_report_null_full().
void talloc_enable_null_tracking | ( | void | ) |
Definition at line 1053 of file talloc.c.
References _talloc_named_const(), and null_context.
Referenced by talloc_enable_leak_report(), talloc_enable_leak_report_full(), and talloc_init().
void * talloc_find_parent_byname | ( | const void * | context, |
const char * | name | ||
) |
Definition at line 1370 of file talloc.c.
References talloc_chunk::name, talloc_chunk::parent, talloc_chunk::prev, talloc_chunk_from_ptr(), and TC_PTR_FROM_CHUNK.
int talloc_free | ( | void * | ptr | ) |
Definition at line 760 of file talloc.c.
References _talloc_free().
Referenced by box_free_box(), form__select_process_selection(), html_destroy(), html_destroy_frameset(), html_destroy_iframe(), and html_free_layout().
void talloc_free_children | ( | void * | ptr | ) |
Definition at line 694 of file talloc.c.
References _talloc_free(), talloc_chunk::child, null_context, talloc_chunk::refs, talloc_chunk_from_ptr(), talloc_parent_chunk(), talloc_steal, TC_PTR_FROM_CHUNK, and unlikely.
const char * talloc_get_name | ( | const void * | ptr | ) |
Definition at line 629 of file talloc.c.
References likely, talloc_chunk::name, talloc_chunk_from_ptr(), TALLOC_MAGIC_REFERENCE, and unlikely.
Referenced by talloc_check_name(), talloc_report_depth_FILE_helper(), and talloc_show_parents().
size_t talloc_get_size | ( | const void * | context | ) |
Definition at line 1355 of file talloc.c.
References talloc_chunk::size, and talloc_chunk_from_ptr().
int talloc_increase_ref_count | ( | const void * | ptr | ) |
Definition at line 266 of file talloc.c.
References null_context, talloc_reference, and unlikely.
void * talloc_init | ( | const char * | fmt, |
... | |||
) |
Definition at line 661 of file talloc.c.
References __talloc(), _talloc_free(), talloc_chunk::name, talloc_enable_null_tracking(), talloc_set_name_v(), and unlikely.
int talloc_is_parent | ( | const void * | context, |
const void * | ptr | ||
) |
Definition at line 1418 of file talloc.c.
References talloc_chunk::parent, talloc_chunk::prev, talloc_chunk_from_ptr(), and TC_PTR_FROM_CHUNK.
Referenced by _talloc_free().
void * talloc_named | ( | const void * | context, |
size_t | size, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 605 of file talloc.c.
References __talloc(), _talloc_free(), talloc_chunk::name, talloc_chunk::size, talloc_set_name_v(), and unlikely.
void * talloc_named_const | ( | const void * | context, |
size_t | size, | ||
const char * | name | ||
) |
Definition at line 747 of file talloc.c.
References _talloc_named_const(), talloc_chunk::name, and talloc_chunk::size.
void * talloc_parent | ( | const void * | ptr | ) |
Definition at line 191 of file talloc.c.
References talloc_parent_chunk(), and TC_PTR_FROM_CHUNK.
|
inlinestatic |
Definition at line 177 of file talloc.c.
References talloc_chunk::parent, talloc_chunk::prev, talloc_chunk_from_ptr(), and unlikely.
Referenced by _talloc_free(), talloc_free_children(), talloc_parent(), talloc_parent_name(), talloc_unlink(), and talloc_unreference().
const char * talloc_parent_name | ( | const void * | ptr | ) |
Definition at line 200 of file talloc.c.
References talloc_chunk::name, and talloc_parent_chunk().
void * talloc_realloc_fn | ( | const void * | context, |
void * | ptr, | ||
size_t | size | ||
) |
Definition at line 1324 of file talloc.c.
References _talloc_realloc(), and talloc_chunk::size.
size_t talloc_reference_count | ( | const void * | ptr | ) |
Definition at line 909 of file talloc.c.
References talloc_reference_handle::next, talloc_chunk::refs, and talloc_chunk_from_ptr().
Referenced by talloc_report_depth_FILE_helper().
|
static |
Definition at line 279 of file talloc.c.
References _TLIST_REMOVE, talloc_reference_handle::ptr, talloc_chunk::refs, and talloc_chunk_from_ptr().
Referenced by _talloc_reference().
void talloc_report | ( | const void * | ptr, |
FILE * | f | ||
) |
Definition at line 1025 of file talloc.c.
References talloc_reference_handle::ptr, and talloc_report_depth_file().
Referenced by talloc_report_null().
void talloc_report_depth_cb | ( | const void * | ptr, |
int | depth, | ||
int | max_depth, | ||
void(*)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data) | callback, | ||
void * | private_data | ||
) |
Definition at line 924 of file talloc.c.
References talloc_chunk::child, talloc_chunk::flags, talloc_chunk::name, talloc_chunk::next, null_context, talloc_reference_handle::ptr, talloc_chunk_from_ptr(), TALLOC_FLAG_LOOP, TALLOC_MAGIC_REFERENCE, talloc_report_depth_cb(), and TC_PTR_FROM_CHUNK.
Referenced by talloc_report_depth_cb(), and talloc_report_depth_file().
void talloc_report_depth_file | ( | const void * | ptr, |
int | depth, | ||
int | max_depth, | ||
FILE * | f | ||
) |
Definition at line 1008 of file talloc.c.
References talloc_reference_handle::ptr, talloc_report_depth_cb(), and talloc_report_depth_FILE_helper().
Referenced by talloc_report(), and talloc_report_full().
|
static |
Definition at line 962 of file talloc.c.
References talloc_reference_handle::ptr, talloc_get_name(), talloc_reference_count(), talloc_total_blocks(), and talloc_total_size().
Referenced by talloc_report_depth_file().
void talloc_report_full | ( | const void * | ptr, |
FILE * | f | ||
) |
Definition at line 1017 of file talloc.c.
References talloc_reference_handle::ptr, and talloc_report_depth_file().
Referenced by ro_gui_window_handle_local_keypress(), and talloc_report_null_full().
|
static |
Definition at line 1033 of file talloc.c.
References null_context, talloc_report(), and talloc_total_size().
Referenced by talloc_enable_leak_report().
|
static |
Definition at line 1043 of file talloc.c.
References null_context, talloc_report_full(), and talloc_total_size().
Referenced by talloc_enable_leak_report_full().
const char * talloc_set_name | ( | const void * | ptr, |
const char * | fmt, | ||
... | |||
) |
Definition at line 589 of file talloc.c.
References talloc_chunk::name, and talloc_set_name_v().
void talloc_set_name_const | ( | const void * | ptr, |
const char * | name | ||
) |
Definition at line 737 of file talloc.c.
References _talloc_set_name_const(), and talloc_chunk::name.
|
inlinestatic |
Definition at line 576 of file talloc.c.
References _talloc_set_name_const(), likely, talloc_chunk::name, talloc_chunk_from_ptr(), and talloc_vasprintf().
Referenced by talloc_init(), talloc_named(), and talloc_set_name().
void talloc_show_parents | ( | const void * | context, |
FILE * | file | ||
) |
Definition at line 1394 of file talloc.c.
References talloc_chunk::parent, talloc_chunk::prev, talloc_chunk_from_ptr(), talloc_get_name(), and TC_PTR_FROM_CHUNK.
char * talloc_strdup | ( | const void * | t, |
const char * | p | ||
) |
Definition at line 1118 of file talloc.c.
References _talloc_set_name_const(), likely, and talloc_memdup.
Referenced by box_a(), box_construct_element(), box_construct_text(), box_create_frameset(), box_embed(), box_get_attribute(), box_iframe(), box_image(), box_input(), box_input_text(), box_object(), box_select(), and form__select_process_selection().
char * talloc_strndup | ( | const void * | t, |
const char * | p, | ||
size_t | n | ||
) |
Definition at line 1160 of file talloc.c.
References __talloc(), and _talloc_set_name_const().
size_t talloc_total_blocks | ( | const void * | ptr | ) |
Definition at line 885 of file talloc.c.
References talloc_chunk::child, talloc_chunk::flags, talloc_chunk::next, talloc_chunk_from_ptr(), TALLOC_FLAG_LOOP, talloc_total_blocks(), and TC_PTR_FROM_CHUNK.
Referenced by talloc_report_depth_FILE_helper(), and talloc_total_blocks().
size_t talloc_total_size | ( | const void * | ptr | ) |
Definition at line 852 of file talloc.c.
References talloc_chunk::child, talloc_chunk::flags, talloc_chunk::next, null_context, talloc_chunk::size, talloc_chunk_from_ptr(), TALLOC_FLAG_LOOP, talloc_total_size(), and TC_PTR_FROM_CHUNK.
Referenced by talloc_report_depth_FILE_helper(), talloc_report_null(), talloc_report_null_full(), and talloc_total_size().
int talloc_unlink | ( | const void * | context, |
void * | ptr | ||
) |
Definition at line 522 of file talloc.c.
References _talloc_free(), null_context, talloc_chunk::refs, talloc_chunk_from_ptr(), talloc_parent_chunk(), talloc_steal, talloc_unreference(), and TC_PTR_FROM_CHUNK.
|
inlinestatic |
Definition at line 494 of file talloc.c.
References _talloc_free(), talloc_reference_handle::next, null_context, talloc_chunk::refs, talloc_chunk_from_ptr(), talloc_parent_chunk(), TC_PTR_FROM_CHUNK, and unlikely.
Referenced by talloc_unlink().
char * talloc_vasprintf | ( | const void * | t, |
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 1183 of file talloc.c.
References __talloc(), _talloc_set_name_const(), and va_copy.
Referenced by talloc_asprintf(), talloc_set_name_v(), and talloc_vasprintf_append().
char * talloc_vasprintf_append | ( | char * | s, |
const char * | fmt, | ||
va_list | ap | ||
) |
Realloc s
to append the formatted result of fmt
and ap
, and return s
, which may have moved.
Good for gradually accumulating output into a string buffer.
Definition at line 1231 of file talloc.c.
References _talloc_set_name_const(), talloc_chunk::size, talloc_chunk_from_ptr(), talloc_realloc, talloc_vasprintf(), and va_copy.
Referenced by talloc_asprintf_append().
|
static |
Definition at line 108 of file talloc.c.
Referenced by talloc_autofree(), talloc_autofree_context(), and talloc_autofree_destructor().
|
static |
Definition at line 107 of file talloc.c.
Referenced by __talloc(), _talloc_free(), _talloc_steal(), talloc_disable_null_tracking(), talloc_enable_null_tracking(), talloc_free_children(), talloc_increase_ref_count(), talloc_report_depth_cb(), talloc_report_null(), talloc_report_null_full(), talloc_total_size(), talloc_unlink(), and talloc_unreference().