coan 4.2.4
|
![]() |
Files | |
file | memory.c |
file | memory.h |
Typedefs | |
typedef char * | heap_str |
typedef char const * | heap_str_const |
Functions | |
void * | allocate (size_t bytes) |
void * | zallocate (size_t bytes) |
void * | reallocate (void *ptr, size_t bytes) |
void * | callocate (size_t items, size_t size) |
void | release (void **pp) |
void * | clone (void const *src, size_t len) |
typedef char* heap_str |
typedef char const* heap_str_const |
void* allocate | ( | size_t | bytes | ) |
malloc()
wrapper; bails on failure
Definition at line 68 of file memory.c.
References no_alloc_fail().
Referenced by canonical_string_copy(), clone(), file_tree_copy(), file_tree_new(), ptr_set_copy(), and ptr_set_new().
void* callocate | ( | size_t | items, |
size_t | size | ||
) |
calloc()
wrapper; bails on failure
Definition at line 87 of file memory.c.
References no_alloc_fail().
Referenced by concatenate(), file_tree_name(), file_tree_traverse(), and new_node().
void* clone | ( | void const * | src, |
size_t | len | ||
) |
Copy a region of memory into a heap block.
src | Address of the region to copy. |
len | Length of the region to copy in bytes, or 0. If 0 then the 0-terminated array of characters at src is copied. |
The returned heap block has always a terminal 0.
Definition at line 101 of file memory.c.
References allocate().
Referenced by canonical_string_copy_init(), canonical_string_init(), canonical_string_substr(), default_cloner(), file_tree_copy_init(), format_int(), get_line(), symbol_copy_init(), symbol_init(), and symbol_resolve().
void* reallocate | ( | void * | ptr, |
size_t | bytes | ||
) |
realloc()
wrapper; bails on failure
Definition at line 81 of file memory.c.
References no_alloc_fail().
Referenced by canonical_string_appendc(), canonical_string_appends(), canonical_string_init(), canonical_string_init_by_test(), ensure_buf(), fs_open_dir(), fs_read_dir(), ptr_vector_insert(), readon(), and vformat_output().
void release | ( | void ** | pp | ) |
Safely free a pointer.
pp | Address of the pointer to be freed |
If *pp is NULL nothing is done. Otherwise *pp is freed and set = NULL.
Definition at line 92 of file memory.c.
Referenced by component_finitor(), eval_numeral(), forget_pending_contradiction(), vformat_output(), and vreport().
void* zallocate | ( | size_t | bytes | ) |
Allocate a zero-initialised heap block; bails on failure
Definition at line 75 of file memory.c.
References no_alloc_fail().
Referenced by canonical_identifier(), canonical_string_init(), canonical_string_new(), canonical_string_replace(), canonical_string_substr(), component_initor(), concatenate(), dataset_filter_filetypes(), fs_compose_filename(), fs_open_dir(), fs_real_path(), fs_split_filename(), make_backup_name(), make_tempfile(), new_node(), parse_args_file(), ptr_vector_copy(), ptr_vector_new(), read_filename(), symbol_copy(), symbol_new(), and vformat_output().