7 #define unwrap(rbnode) ((rbnode) ? container_of(rbnode, RzIntervalNode, node) : NULL)
13 for (
i = 0;
i < 2;
i++) {
23 static int cmp(
const void *incoming,
const RBNode *in_tree,
void *user) {
24 ut64 incoming_start = *(
ut64 *)incoming;
26 if (incoming_start < other_start) {
29 if (incoming_start > other_start) {
39 if (node == incoming_node) {
52 if (!path_cache->
len) {
56 path_cache->
path[path_cache->
len++] = cur;
68 if (intervalnode == incoming_node || intervalnode->
start > incoming_node->
start) {
73 if (rbnode->
child[1]) {
75 for (rbnode = rbnode->
child[1]; rbnode; rbnode = rbnode->
child[0]) {
76 path_cache->
path[path_cache->
len++] = rbnode;
81 rbnode = path_cache->
path[--path_cache->
len];
82 }
while (path_cache->
len && path_cache->
path[path_cache->
len - 1]->
child[1] == rbnode);
90 for (
i = 0;
i < path_cache->
len - 1;
i++) {
92 next_child = path_cache->
path[
i + 1];
98 return (next_child && node->
node.
child[0] == next_child) ? -1 : 1;
115 if (!tree || !tree->
root) {
141 RBIter path_cache = { 0 };
149 if (node->
start != new_start) {
151 void *data = node->
data;
157 if (node->
end != new_end) {
160 RBIter path_cache = { 0 };
172 if (start < node->
start) {
188 if (!top_intervalnode) {
197 node = node->
child[0];
199 node = node->
child[1];
213 if (intervalnode->
data == data) {
229 ret =
cb(intervalnode, user);
239 while (node && value < node->
start) {
249 if (end_inclusive ? value <= node->
end : value < node->
end) {
250 if (!
cb(node, user)) {
269 while (node && (end_inclusive ? end < node->
start : end <= node->
start)) {
279 if (end_inclusive ? start <= node->
end : start < node->
end) {
280 if (!
cb(node, user)) {
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API bool rz_interval_tree_all_intersect(RzIntervalTree *tree, ut64 start, ut64 end, bool end_inclusive, RzIntervalIterCb cb, void *user)
static int cmp(const void *incoming, const RBNode *in_tree, void *user)
RZ_API bool rz_interval_tree_delete(RzIntervalTree *tree, RzIntervalNode *node, bool free)
RZ_API bool rz_interval_node_all_in(RzIntervalNode *node, ut64 value, bool end_inclusive, RzIntervalIterCb cb, void *user)
RZ_API RzIntervalNode * rz_interval_tree_node_at(RzIntervalTree *tree, ut64 start)
RZ_API bool rz_interval_tree_all_in(RzIntervalTree *tree, ut64 value, bool end_inclusive, RzIntervalIterCb cb, void *user)
static int cmp_exact_node(const void *incoming, const RBNode *in_tree, void *user)
RZ_API RzIntervalNode * rz_interval_tree_node_at_data(RzIntervalTree *tree, ut64 start, void *data)
static void node_max(RBNode *node)
RZ_API bool rz_interval_tree_resize(RzIntervalTree *tree, RzIntervalNode *node, ut64 new_start, ut64 new_end)
RZ_API bool rz_interval_tree_all_at(RzIntervalTree *tree, ut64 start, RzIntervalIterCb cb, void *user)
RZ_API void rz_interval_tree_init(RzIntervalTree *tree, RzIntervalNodeFree free)
RZ_API bool rz_interval_tree_insert(RzIntervalTree *tree, ut64 start, ut64 end, void *data)
RZ_API RBIter rz_interval_tree_first_at(RzIntervalTree *tree, ut64 start)
static void interval_node_free(RBNode *node, void *user)
static bool rz_interval_node_all_intersect(RzIntervalNode *node, ut64 start, ut64 end, bool end_inclusive, RzIntervalIterCb cb, void *user)
RZ_API void rz_interval_tree_fini(RzIntervalTree *tree)
while(len< limit &&buf1[len]==buf2[len])++len
#define rz_return_val_if_fail(expr, val)
void(* RzIntervalNodeFree)(void *data)
bool(* RzIntervalIterCb)(RzIntervalNode *node, void *user)
#define rz_rbtree_iter_get(it, struc, rb)
RZ_API void rz_rbtree_free(RZ_NULLABLE RBNode *root, RBNodeFree freefn, void *user)
void(* RContRBFree)(void *)
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.
#define rz_rbtree_iter_has(it)
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.
RZ_API void rz_rbtree_iter_next(RBIter *it)
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.
#define container_of(ptr, type, member)
RBNode * path[RZ_RBTREE_MAX_HEIGHT]
struct rz_rb_node_t * child[2]
ut64(WINAPI *w32_GetEnabledXStateFeatures)()