Asterisk - The Open Source Telephony Project
18.5.0
|
String fields. More...
Go to the source code of this file.
Macros | |
#define | ALLOCATOR_OVERHEAD 48 |
Functions | |
void * | __ast_calloc_with_stringfields (unsigned int num_structs, size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size, const char *file, int lineno, const char *func) |
ast_string_field | __ast_string_field_alloc_space (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t needed, const char *file, int lineno, const char *func) |
int | __ast_string_field_free_memory (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, enum ast_stringfield_cleanup_type cleanup_type, const char *file, int lineno, const char *func) |
Internal cleanup function. More... | |
int | __ast_string_field_init (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, int needed, const char *file, int lineno, const char *func) |
Internal initialization function. More... | |
void | __ast_string_field_ptr_build (const char *file, int lineno, const char *func, struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format,...) |
void | __ast_string_field_ptr_build_va (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format, va_list ap, const char *file, int lineno, const char *func) |
int | __ast_string_field_ptr_grow (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t needed, const ast_string_field *ptr) |
void | __ast_string_field_release_active (struct ast_string_field_pool *pool_head, const ast_string_field ptr) |
int | __ast_string_fields_cmp (struct ast_string_field_vector *left, struct ast_string_field_vector *right) |
int | __ast_string_fields_copy (struct ast_string_field_pool *copy_pool, struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr, const char *file, int lineno, const char *func) |
static int | add_string_pool (struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t size, const char *file, int lineno, const char *func) |
add a new block to the pool. We can only allocate from the topmost pool, so the fields in *mgr reflect the size of that only. More... | |
static size_t | optimal_alloc_size (size_t size) |
static void | reset_field (const char **p) |
Variables | |
ast_string_field | __ast_string_field_empty = __ast_string_field_empty_buffer.string |
struct { | |
ast_string_field_allocation allocation | |
char string [1] | |
} | __ast_string_field_empty_buffer |
String fields.
Definition in file stringfields.c.
#define ALLOCATOR_OVERHEAD 48 |
Definition at line 45 of file stringfields.c.
Referenced by optimal_alloc_size().
void* __ast_calloc_with_stringfields | ( | unsigned int | num_structs, |
size_t | struct_size, | ||
size_t | field_mgr_offset, | ||
size_t | field_mgr_pool_offset, | ||
size_t | pool_size, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 380 of file stringfields.c.
References __ast_calloc(), __ast_string_field_empty, allocation, ast_assert, ast_free, AST_VECTOR_APPEND, AST_VECTOR_INIT, ast_string_field_mgr::embedded_pool, NULL, optimal_alloc_size(), pool, ast_string_field_pool::size, and ast_string_field_mgr::string_fields.
ast_string_field __ast_string_field_alloc_space | ( | struct ast_string_field_mgr * | mgr, |
struct ast_string_field_pool ** | pool_head, | ||
size_t | needed, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 202 of file stringfields.c.
References add_string_pool(), ast_alignof, ast_assert, ast_make_room_for, AST_STRING_FIELD_ALLOCATION, ast_string_field_mgr::last_alloc, NULL, and result.
Referenced by __ast_string_field_ptr_build_va().
int __ast_string_field_free_memory | ( | struct ast_string_field_mgr * | mgr, |
struct ast_string_field_pool ** | pool_head, | ||
enum ast_stringfield_cleanup_type | cleanup_type, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Internal cleanup function.
Definition at line 103 of file stringfields.c.
References ast_string_field_pool::active, ast_free, ast_log, AST_STRINGFIELD_DESTROY, AST_STRINGFIELD_RESET, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, ast_string_field_mgr::embedded_pool, LOG_WARNING, NULL, ast_string_field_pool::prev, reset_field(), ast_string_field_mgr::string_fields, and ast_string_field_pool::used.
Referenced by __ast_string_field_init().
int __ast_string_field_init | ( | struct ast_string_field_mgr * | mgr, |
struct ast_string_field_pool ** | pool_head, | ||
int | needed, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Internal initialization function.
Definition at line 171 of file stringfields.c.
References __ast_string_field_empty, __ast_string_field_free_memory(), add_string_pool(), AST_VECTOR_APPEND, AST_VECTOR_FREE, AST_VECTOR_INIT, ast_string_field_mgr::embedded_pool, ast_string_field_mgr::last_alloc, NULL, and ast_string_field_mgr::string_fields.
void __ast_string_field_ptr_build | ( | const char * | file, |
int | lineno, | ||
const char * | func, | ||
struct ast_string_field_mgr * | mgr, | ||
struct ast_string_field_pool ** | pool_head, | ||
ast_string_field * | ptr, | ||
const char * | format, | ||
... | |||
) |
Definition at line 369 of file stringfields.c.
References __ast_string_field_ptr_build_va().
void __ast_string_field_ptr_build_va | ( | struct ast_string_field_mgr * | mgr, |
struct ast_string_field_pool ** | pool_head, | ||
ast_string_field * | ptr, | ||
const char * | format, | ||
va_list | ap, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 286 of file stringfields.c.
References __ast_string_field_alloc_space(), __ast_string_field_empty, __ast_string_field_release_active(), ast_align_for, ast_alignof, ast_assert, ast_make_room_for, AST_STRING_FIELD_ALLOCATION, available(), grow(), and ast_string_field_mgr::last_alloc.
Referenced by __ast_string_field_ptr_build().
int __ast_string_field_ptr_grow | ( | struct ast_string_field_mgr * | mgr, |
struct ast_string_field_pool ** | pool_head, | ||
size_t | needed, | ||
const ast_string_field * | ptr | ||
) |
Definition at line 240 of file stringfields.c.
References AST_STRING_FIELD_ALLOCATION, grow(), and ast_string_field_mgr::last_alloc.
void __ast_string_field_release_active | ( | struct ast_string_field_pool * | pool_head, |
const ast_string_field | ptr | ||
) |
Definition at line 261 of file stringfields.c.
References __ast_string_field_empty, ast_string_field_pool::active, ast_free, AST_STRING_FIELD_ALLOCATION, NULL, pool, and ast_string_field_pool::prev.
Referenced by __ast_string_field_ptr_build_va(), and __ast_string_fields_copy().
int __ast_string_fields_cmp | ( | struct ast_string_field_vector * | left, |
struct ast_string_field_vector * | right | ||
) |
Definition at line 424 of file stringfields.c.
References ast_assert, AST_VECTOR_GET, and AST_VECTOR_SIZE.
int __ast_string_fields_copy | ( | struct ast_string_field_pool * | copy_pool, |
struct ast_string_field_mgr * | copy_mgr, | ||
struct ast_string_field_mgr * | orig_mgr, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Definition at line 441 of file stringfields.c.
References __ast_string_field_empty, __ast_string_field_ptr_set_by_fields, __ast_string_field_release_active(), ast_assert, AST_VECTOR_GET, AST_VECTOR_SIZE, and ast_string_field_mgr::string_fields.
|
static |
add a new block to the pool. We can only allocate from the topmost pool, so the fields in *mgr reflect the size of that only.
Definition at line 62 of file stringfields.c.
References __ast_calloc(), ast_string_field_mgr::last_alloc, NULL, optimal_alloc_size(), pool, ast_string_field_pool::prev, and ast_string_field_pool::size.
Referenced by __ast_string_field_alloc_space(), and __ast_string_field_init().
|
static |
Definition at line 47 of file stringfields.c.
References ALLOCATOR_OVERHEAD.
Referenced by __ast_calloc_with_stringfields(), and add_string_pool().
|
static |
Definition at line 81 of file stringfields.c.
References __ast_string_field_empty.
Referenced by __ast_string_field_free_memory().
ast_string_field __ast_string_field_empty = __ast_string_field_empty_buffer.string |
Definition at line 43 of file stringfields.c.
Referenced by __ast_calloc_with_stringfields(), __ast_string_field_init(), __ast_string_field_ptr_build_va(), __ast_string_field_release_active(), __ast_string_fields_copy(), AST_TEST_DEFINE(), and reset_field().
const { ... } __ast_string_field_empty_buffer |
ast_string_field_allocation allocation |
Definition at line 39 of file stringfields.c.
Referenced by __ast_calloc_with_stringfields().
char string[1] |
Definition at line 40 of file stringfields.c.