62 return h->
heap[i - 1];
92 for (i = 1; i <= (h->
cur_len / 2); i++) {
96 if (l <= h->cur_len) {
102 if (r <= h->cur_len) {
239 if (!index || index > h->
cur_len) {
Asterisk main include file. File version handling, generic pbx functions.
void * __ast_malloc(size_t size, const char *file, int lineno, const char *func) attribute_malloc
void * __ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) attribute_malloc
Standard Command Line Interface.
static void heap_set(struct ast_heap *h, int i, void *elm)
int ast_heap_verify(struct ast_heap *h)
Verify that a heap has been properly constructed.
struct ast_heap * _ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn, ssize_t index_offset, const char *file, int lineno, const char *func)
static void max_heapify(struct ast_heap *h, int i)
static int bubble_up(struct ast_heap *h, int i)
static void heap_swap(struct ast_heap *h, int i, int j)
struct ast_heap * ast_heap_destroy(struct ast_heap *h)
Destroy a max heap.
static int grow_heap(struct ast_heap *h, const char *file, int lineno, const char *func)
Add a row of additional storage for the heap.
static ssize_t get_index(struct ast_heap *h, void *elm)
void * ast_heap_pop(struct ast_heap *h)
Pop the max element off of the heap.
static int left_node(int i)
void * ast_heap_remove(struct ast_heap *h, void *elm)
Remove a specific element from a heap.
int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line)
Read-Lock a heap.
static void * heap_get(struct ast_heap *h, int i)
static void * _ast_heap_remove(struct ast_heap *h, unsigned int index)
int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line)
Unlock a heap.
size_t ast_heap_size(struct ast_heap *h)
Get the current size of a heap.
static int right_node(int i)
int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line)
Write-Lock a heap.
static int parent_node(int i)
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func)
void * ast_heap_peek(struct ast_heap *h, unsigned int index)
Peek at an element on a heap.
int(* ast_heap_cmp_fn)(void *elm1, void *elm2)
Function type for comparing nodes in a heap.
int __ast_rwlock_wrlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
int __ast_rwlock_unlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
#define ast_rwlock_init(rwlock)
wrapper for rwlock with tracking enabled
#define ast_rwlock_destroy(rwlock)
int __ast_rwlock_rdlock(const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
Structure for rwlock and tracking information.