Rizin
unix-like reverse engineering framework and cli tools
|
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <stdbool.h>
#include "./alloc.h"
Go to the source code of this file.
Macros | |
#define | Array(T) |
#define | array_init(self) ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) |
#define | array_new() { NULL, 0, 0 } |
#define | array_get(self, index) (assert((uint32_t)index < (self)->size), &(self)->contents[index]) |
#define | array_front(self) array_get(self, 0) |
#define | array_back(self) array_get(self, (self)->size - 1) |
#define | array_clear(self) ((self)->size = 0) |
#define | array_reserve(self, new_capacity) array__reserve((VoidArray *)(self), array__elem_size(self), new_capacity) |
#define | array_delete(self) array__delete((VoidArray *)self) |
#define | array_push(self, element) |
#define | array_grow_by(self, count) |
#define | array_push_all(self, other) array_extend((self), (other)->size, (other)->contents) |
#define | array_extend(self, count, contents) |
#define | array_splice(self, index, old_count, new_count, new_contents) |
#define | array_insert(self, index, element) array__splice((VoidArray *)(self), array__elem_size(self), index, 0, 1, &element) |
#define | array_erase(self, index) array__erase((VoidArray *)(self), array__elem_size(self), index) |
#define | array_pop(self) ((self)->contents[--(self)->size]) |
#define | array_assign(self, other) array__assign((VoidArray *)(self), (const VoidArray *)(other), array__elem_size(self)) |
#define | array_swap(self, other) array__swap((VoidArray *)(self), (VoidArray *)(other)) |
#define | array_search_sorted_with(self, compare, needle, index, exists) array__search_sorted(self, 0, compare, , needle, index, exists) |
#define | array_search_sorted_by(self, field, needle, index, exists) array__search_sorted(self, 0, _compare_int, field, needle, index, exists) |
#define | array_insert_sorted_with(self, compare, value) |
#define | array_insert_sorted_by(self, field, value) |
#define | array__elem_size(self) sizeof(*(self)->contents) |
#define | array__search_sorted(self, start, compare, suffix, needle, index, exists) |
#define | _compare_int(a, b) ((int)*(a) - (int)(b)) |
Functions | |
typedef | Array (void) VoidArray |
static void | array__delete (VoidArray *self) |
static void | array__erase (VoidArray *self, size_t element_size, uint32_t index) |
static void | array__reserve (VoidArray *self, size_t element_size, uint32_t new_capacity) |
static void | array__assign (VoidArray *self, const VoidArray *other, size_t element_size) |
static void | array__swap (VoidArray *self, VoidArray *other) |
static void | array__grow (VoidArray *self, size_t count, size_t element_size) |
static void | array__splice (VoidArray *self, size_t element_size, uint32_t index, uint32_t old_count, uint32_t new_count, const void *elements) |
#define array_assign | ( | self, | |
other | |||
) | array__assign((VoidArray *)(self), (const VoidArray *)(other), array__elem_size(self)) |
#define array_delete | ( | self | ) | array__delete((VoidArray *)self) |
#define array_erase | ( | self, | |
index | |||
) | array__erase((VoidArray *)(self), array__elem_size(self), index) |
#define array_extend | ( | self, | |
count, | |||
contents | |||
) |
#define array_grow_by | ( | self, | |
count | |||
) |
#define array_insert | ( | self, | |
index, | |||
element | |||
) | array__splice((VoidArray *)(self), array__elem_size(self), index, 0, 1, &element) |
#define array_insert_sorted_by | ( | self, | |
field, | |||
value | |||
) |
#define array_push | ( | self, | |
element | |||
) |
#define array_push_all | ( | self, | |
other | |||
) | array_extend((self), (other)->size, (other)->contents) |
#define array_reserve | ( | self, | |
new_capacity | |||
) | array__reserve((VoidArray *)(self), array__elem_size(self), new_capacity) |
#define array_search_sorted_by | ( | self, | |
field, | |||
needle, | |||
index, | |||
exists | |||
) | array__search_sorted(self, 0, _compare_int, field, needle, index, exists) |
#define array_search_sorted_with | ( | self, | |
compare, | |||
needle, | |||
index, | |||
exists | |||
) | array__search_sorted(self, 0, compare, , needle, index, exists) |
#define array_splice | ( | self, | |
index, | |||
old_count, | |||
new_count, | |||
new_contents | |||
) |
#define array_swap | ( | self, | |
other | |||
) | array__swap((VoidArray *)(self), (VoidArray *)(other)) |
typedef Array | ( | void | ) |
|
inlinestatic |
Definition at line 161 of file array.h.
References array__reserve(), and memcpy().
|
inlinestatic |
Definition at line 150 of file array.h.
References ts_malloc, and ts_realloc.
Referenced by array__assign(), array__grow(), and array__splice().
|
inlinestatic |