45#define ALLOCATOR_OVERHEAD 48 
   53    for (count = 1; size; size >>= 1, count++);
 
 
   63    size_t size, 
const char *file, 
int lineno, 
const char *func)
 
   73    pool->
prev = *pool_head;
 
   74    pool->
size = alloc_size - 
sizeof(*pool);
 
 
  105    const char *file, 
int lineno, 
const char *func)
 
  113    switch (cleanup_type) {
 
  128            if (*pool_head == 
NULL) {
 
  132            preserve = *pool_head;
 
  144        if (cur != preserve) {
 
  150    *pool_head = preserve;
 
 
  172    int needed, 
const char *file, 
int lineno, 
const char *func)
 
  174    const char **p = (
const char **) pool_head + 1;
 
  175    size_t initial_vector_size = ((size_t) (((
char *)mgr) - ((
char *)p))) / 
sizeof(*p);
 
 
  204    const char *file, 
int lineno, 
const char *func)
 
  207    size_t space = (*pool_head)->size - (*pool_head)->used;
 
  214    if (__builtin_expect(to_alloc > space, 0)) {
 
  215        size_t new_size = (*pool_head)->size;
 
  217        while (new_size < to_alloc) {
 
  230    result = (*pool_head)->base + (*pool_head)->used;
 
  231    (*pool_head)->used += to_alloc;
 
  232    (*pool_head)->active += needed;
 
 
  244    size_t space = (*pool_head)->size - (*pool_head)->used;
 
  254    (*pool_head)->used += 
grow;
 
  255    (*pool_head)->active += 
grow;
 
 
  271        if ((ptr >= pool->
base) && (ptr <= (pool->
base + pool->
size))) {
 
 
  288    const char *format, va_list ap,
 
  289    const char *file, 
int lineno, 
const char *func)
 
  293    size_t space = (*pool_head)->size - (*pool_head)->used;
 
  304        target = (
char *) *ptr;
 
  322    res = vsnprintf(target, 
available, format, ap2);
 
  334    needed = (size_t)res + 1; 
 
  345        vsprintf(target, format, ap);
 
  349    } 
else if (*ptr != target) {
 
  358        (*pool_head)->active += needed;
 
  365        (*pool_head)->active += 
grow;
 
 
  375    va_start(ap, format);
 
 
  381    size_t field_mgr_offset, 
size_t field_mgr_pool_offset, 
size_t pool_size,
 
  382    const char *file, 
int lineno, 
const char *func)
 
  387    size_t pool_size_needed = 
sizeof(*pool) + pool_size;
 
  391    size_t initial_vector_size;
 
  403    pool_head = 
allocation + field_mgr_pool_offset;
 
  404    p = (
const char **) pool_head + 1;
 
  405    initial_vector_size = ((size_t) (((
char *)mgr) - ((
char *)p))) / 
sizeof(*p);
 
  419    pool->
size = size_to_alloc - struct_size - 
sizeof(*pool);
 
 
  443    const char *file, 
int lineno, 
const char *func)
 
 
Asterisk main include file. File version handling, generic pbx functions.
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) attribute_malloc
static int available(struct dahdi_pvt **pvt, int is_specific_channel)
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_fields_cmp(struct ast_string_field_vector *left, struct ast_string_field_vector *right)
static void reset_field(const char **p)
void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, const ast_string_field ptr)
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)
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,...)
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.
ast_string_field_allocation allocation
static const struct @436 __ast_string_field_empty_buffer
ast_string_field __ast_string_field_empty
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.
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)
#define ALLOCATOR_OVERHEAD
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 reflec...
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_ptr_grow(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t needed, const ast_string_field *ptr)
static size_t optimal_alloc_size(size_t size)
#define __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func)
uint16_t ast_string_field_allocation
ast_stringfield_cleanup_type
@ AST_STRINGFIELD_DESTROY
const char * ast_string_field
#define AST_STRING_FIELD_ALLOCATION(x)
Macro to provide access to the allocation field that lives immediately in front of a string field.
struct ast_string_field_vector string_fields
struct ast_string_field_pool * embedded_pool
ast_string_field last_alloc
struct ast_string_field_pool * prev
static void grow(struct ast_threadpool *pool, int delta)
Add threads to the threadpool.
#define ast_align_for(offset, type)
Increase offset so it is a multiple of the required alignment of type.
#define ast_make_room_for(offset, type)
Increase offset by the required alignment of type and make sure it is a multiple of said alignment.
#define ast_alignof(type)
Return the number of bytes used in the alignment of type.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.