Add rbtree iterator implementation

This commit is contained in:
2022-08-24 12:28:45 +03:00
parent 8858e02afb
commit 4a174df6da
3 changed files with 179 additions and 3 deletions
+13
View File
@@ -64,6 +64,17 @@ extern int libcdsb_builtin_vtype_compare_values (const void* s0, vtype t0,
extern int libcdsb_builtin_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) pure__ wur__;
extern hash_t libcdsb_builtin_vtype_hash (const void* value, vtype type) pure__ wur__;
ainline(stack_t* libcdsb_builtin_stack_insert(stack_t* x, void* v)) {
stack_t* p = x->prev;
if (!is_null(x->prev = malloc(sizeof(*x)))) {
x->prev->prev = p;
x->prev->value = v;
} else abort();
return x->prev;
}
#define aligned_alloc libcdsb_aalloc
#define malloc libcdsb_malloc
#define calloc libcdsb_calloc
@@ -72,7 +83,9 @@ extern hash_t libcdsb_builtin_vtype_hash (const void* value, vtype t
#define stack_init libcdsb_stack_init
#define stack_push libcdsb_stack_push
#define stack_push_many libcdsb_stack_push_many
#define stack_insert libcdsb_builtin_stack_insert
#define stack_pop libcdsb_stack_pop
#define stack_reverse libcdsb_stack_reverse
#define stack_flush libcdsb_stack_flush
#define strlen libcdsb_strlen
#define strasciilen libcdsb_strasciilen