Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_rb_node_t |
struct | rz_rb_iter_t |
struct | rz_containing_rb_node_t |
struct | rz_containing_rb_tree_t |
Macros | |
#define | RZ_RBTREE_MAX_HEIGHT 62 |
#define | rz_rbtree_iter_get(it, struc, rb) (container_of((it)->path[(it)->len - 1], struc, rb)) |
#define | rz_rbtree_iter_has(it) ((it)->len) |
#define | rz_rbtree_iter_while(it, data, struc, rb) for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it))) |
#define | rz_rbtree_iter_while_prev(it, data, struc, rb) for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it))) |
#define | rz_rbtree_foreach(root, it, data, struc, rb) for ((it) = rz_rbtree_first(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it))) |
#define | rz_rbtree_foreach_prev(root, it, data, struc, rb) for ((it) = rz_rbtree_last(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it))) |
#define | rz_rbtree_cont_foreach(tree, it, dat) for ((it) = rz_rbtree_first((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_next(&(it))) |
#define | rz_rbtree_cont_foreach_prev(tree, it, dat) for ((it) = rz_rbtree_last((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_prev(&(it))) |
Typedefs | |
typedef struct rz_rb_node_t | RBNode |
typedef RBNode * | RBTree |
typedef int(* | RBComparator) (const void *incoming, const RBNode *in_tree, void *user) |
typedef void(* | RBNodeFree) (RBNode *node, void *user) |
typedef void(* | RBNodeSum) (RBNode *node) |
typedef struct rz_rb_iter_t | RBIter |
typedef int(* | RContRBCmp) (void *incoming, void *in, void *user) |
typedef void(* | RContRBFree) (void *) |
typedef struct rz_containing_rb_node_t | RContRBNode |
typedef struct rz_containing_rb_tree_t | RContRBTree |
#define rz_rbtree_cont_foreach | ( | tree, | |
it, | |||
dat | |||
) | for ((it) = rz_rbtree_first((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_next(&(it))) |
Definition at line 113 of file rz_rbtree.h.
#define rz_rbtree_cont_foreach_prev | ( | tree, | |
it, | |||
dat | |||
) | for ((it) = rz_rbtree_last((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_prev(&(it))) |
Definition at line 116 of file rz_rbtree.h.
#define rz_rbtree_foreach | ( | root, | |
it, | |||
data, | |||
struc, | |||
rb | |||
) | for ((it) = rz_rbtree_first(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it))) |
Definition at line 101 of file rz_rbtree.h.
#define rz_rbtree_foreach_prev | ( | root, | |
it, | |||
data, | |||
struc, | |||
rb | |||
) | for ((it) = rz_rbtree_last(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it))) |
Definition at line 104 of file rz_rbtree.h.
#define rz_rbtree_iter_get | ( | it, | |
struc, | |||
rb | |||
) | (container_of((it)->path[(it)->len - 1], struc, rb)) |
Definition at line 85 of file rz_rbtree.h.
#define rz_rbtree_iter_has | ( | it | ) | ((it)->len) |
Definition at line 87 of file rz_rbtree.h.
#define rz_rbtree_iter_while | ( | it, | |
data, | |||
struc, | |||
rb | |||
) | for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it))) |
Definition at line 94 of file rz_rbtree.h.
#define rz_rbtree_iter_while_prev | ( | it, | |
data, | |||
struc, | |||
rb | |||
) | for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it))) |
Definition at line 98 of file rz_rbtree.h.
#define RZ_RBTREE_MAX_HEIGHT 62 |
Definition at line 16 of file rz_rbtree.h.
Definition at line 29 of file rz_rbtree.h.
typedef struct rz_rb_iter_t RBIter |
typedef struct rz_rb_node_t RBNode |
typedef void(* RBNodeFree) (RBNode *node, void *user) |
Definition at line 31 of file rz_rbtree.h.
typedef void(* RBNodeSum) (RBNode *node) |
Definition at line 32 of file rz_rbtree.h.
Definition at line 24 of file rz_rbtree.h.
Definition at line 46 of file rz_rbtree.h.
typedef void(* RContRBFree) (void *) |
Definition at line 47 of file rz_rbtree.h.
typedef struct rz_containing_rb_node_t RContRBNode |
typedef struct rz_containing_rb_tree_t RContRBTree |
RZ_API bool rz_rbtree_aug_delete | ( | RBNode ** | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | cmp_user, | ||
RBNodeFree | freefn, | ||
void * | free_user, | ||
RBNodeSum | sum | ||
) |
Returns true if a node with an equal key is deleted.
Definition at line 67 of file rbtree.c.
References rz_rb_node_t::child, cmp(), d, d2, d3, del(), freefn(), g, test-lz4-versions::head, NULL, p, path, rz_rb_node_t::red, red(), root, RZ_LOG_ERROR, RZ_RBTREE_MAX_HEIGHT, s, zag(), and zig_zag().
Referenced by rz_analysis_block_merge(), rz_analysis_block_relocate(), rz_analysis_block_unref(), rz_interval_tree_delete(), rz_rbtree_cont_delete(), and rz_rbtree_delete().
RZ_API bool rz_rbtree_aug_insert | ( | RBNode ** | root, |
void * | data, | ||
RBNode * | node, | ||
RBComparator | cmp, | ||
void * | cmp_user, | ||
RBNodeSum | sum | ||
) |
Returns true if the node was inserted successfully.
Definition at line 163 of file rbtree.c.
References rz_rb_node_t::child, cmp(), d, d2, d3, done, g, NULL, p, path, rz_rb_node_t::red, red(), root, RZ_LOG_ERROR, RZ_RBTREE_MAX_HEIGHT, zag(), and zig_zag().
Referenced by rz_analysis_block_relocate(), rz_analysis_block_split(), rz_analysis_create_block(), rz_analysis_var_global_add(), rz_interval_tree_insert(), rz_rbtree_cont_insert(), and rz_rbtree_insert().
RZ_API bool rz_rbtree_aug_update_sum | ( | RBNode * | root, |
void * | data, | ||
RBNode * | node, | ||
RBComparator | cmp, | ||
void * | cmp_user, | ||
RBNodeSum | sum | ||
) |
Returns true if the sum has been updated, false if node has not been found.
Definition at line 235 of file rbtree.c.
References rz_rb_node_t::child, cmp(), d, path, root, RZ_LOG_ERROR, and RZ_RBTREE_MAX_HEIGHT.
Referenced by rz_analysis_block_set_size(), and rz_interval_tree_resize().
RZ_API bool rz_rbtree_cont_delete | ( | RContRBTree * | tree, |
void * | data, | ||
RContRBCmp | cmp, | ||
void * | user | ||
) |
Definition at line 443 of file rbtree.c.
References cmp(), cont_node_free(), cont_rbtree_free_cmp_wrapper(), container_of, rz_containing_rb_tree_t::free, rz_containing_rb_node_t::node, NULL, rz_containing_rb_tree_t::root, and rz_rbtree_aug_delete().
RZ_API void* rz_rbtree_cont_find | ( | RContRBTree * | tree, |
void * | data, | ||
RContRBCmp | cmp, | ||
void * | user | ||
) |
Definition at line 457 of file rbtree.c.
References cmp(), cont_rbtree_search_cmp_wrapper(), container_of, rz_containing_rb_node_t::node, NULL, rz_containing_rb_tree_t::root, rz_rbtree_find(), and rz_return_val_if_fail.
RZ_API void rz_rbtree_cont_free | ( | RContRBTree * | tree | ) |
Definition at line 471 of file rbtree.c.
References cont_node_free(), rz_containing_rb_tree_t::free, free(), rz_containing_rb_node_t::node, rz_containing_rb_tree_t::root, and rz_rbtree_free().
RZ_API bool rz_rbtree_cont_insert | ( | RContRBTree * | tree, |
void * | data, | ||
RContRBCmp | cmp, | ||
void * | user | ||
) |
Definition at line 404 of file rbtree.c.
References cmp(), cont_rbtree_cmp_wrapper(), container_of, rz_containing_rb_node_t::data, free(), rz_containing_rb_node_t::node, NULL, rz_containing_rb_tree_t::root, RZ_LOG_ERROR, RZ_NEW0, rz_rbtree_aug_insert(), and rz_return_val_if_fail.
RZ_API RZ_OWN RContRBTree* rz_rbtree_cont_new | ( | void | ) |
RZ_API RZ_OWN RContRBTree* rz_rbtree_cont_newf | ( | RContRBFree | f | ) |
Definition at line 367 of file rbtree.c.
References f, rz_containing_rb_tree_t::free, and rz_rbtree_cont_new().
RZ_API bool rz_rbtree_delete | ( | RBNode ** | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | cmp_user, | ||
RBNodeFree | freefn, | ||
void * | free_user | ||
) |
Returns true if a node with an equal key is deleted.
Definition at line 263 of file rbtree.c.
References cmp(), freefn(), NULL, root, and rz_rbtree_aug_delete().
Referenced by rz_analysis_hint_unset_arch(), rz_analysis_hint_unset_bits(), rz_analysis_var_global_delete(), rz_spaces_rename(), and spaces_unset_single().
RZ_API RBNode* rz_rbtree_find | ( | RBNode * | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
Definition at line 267 of file rbtree.c.
References cmp(), d, NULL, and x.
Referenced by ensure_ranged_hint_record(), rz_analysis_get_block_at(), rz_analysis_var_global_get_byaddr_at(), rz_bin_pdb_get_type_by_index(), rz_rbtree_cont_find(), and rz_spaces_get().
RZ_API void rz_rbtree_free | ( | RZ_NULLABLE RBNode * | root, |
RBNodeFree | freefn, | ||
void * | user | ||
) |
Definition at line 281 of file rbtree.c.
References freefn(), rz_rbtree_free(), and x.
Referenced by free_tpi_stream(), rz_analysis_free(), rz_analysis_hint_storage_fini(), rz_core_analysis_hint_list_print(), rz_core_analysis_hint_print(), rz_interval_tree_fini(), rz_rbtree_cont_free(), rz_rbtree_free(), rz_spaces_fini(), and rz_spaces_purge().
RZ_API bool rz_rbtree_insert | ( | RBNode ** | root, |
void * | data, | ||
RBNode * | node, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
Returns true if the node was inserted successfully.
Definition at line 291 of file rbtree.c.
References cmp(), NULL, root, and rz_rbtree_aug_insert().
Referenced by ensure_ranged_hint_record(), parse_simple_type(), parse_tpi_stream(), print_addr_hint_cb(), print_arch_hint_cb(), print_bits_hint_cb(), rz_spaces_add(), and rz_spaces_rename().
Definition at line 355 of file rbtree.c.
References _next().
Referenced by rz_interval_tree_all_at(), and rz_interval_tree_node_at_data().
RZ_API RBNode* rz_rbtree_lower_bound | ( | RBNode * | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
RZ_API RBIter rz_rbtree_lower_bound_forward | ( | RBNode * | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
Definition at line 309 of file rbtree.c.
References bound_iter(), cmp(), and root.
RZ_API RBNode* rz_rbtree_upper_bound | ( | RBNode * | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
Definition at line 313 of file rbtree.c.
References cmp(), d, NULL, and x.
Referenced by rz_analysis_hint_arch_at(), rz_analysis_hint_bits_at(), and rz_analysis_var_global_get_byaddr_in().
RZ_API RBIter rz_rbtree_upper_bound_backward | ( | RBNode * | root, |
void * | data, | ||
RBComparator | cmp, | ||
void * | user | ||
) |
Definition at line 327 of file rbtree.c.
References bound_iter(), cmp(), and root.