12 #define SKIPLIST_MAX_DEPTH 31
55 for (
i =
list->list_level;
i >= 0;
i--) {
57 while (
x->forward[
i] !=
list->head &&
list->compare(
x->forward[
i]->data, data) < 0) {
61 while (
x->forward[
i] !=
list->head &&
x->forward[
i] != data) {
80 if (
x ==
list->head ||
list->compare(
x->data, data) != 0) {
86 for (
i = 0;
i <=
list->list_level;
i++) {
95 while ((
list->list_level > 0) &&
120 list->list_level = 0;
123 list->compare = comparefn;
133 n =
list->head->forward[0];
134 while (
n !=
list->head) {
141 list->list_level = 0;
159 int i, x_level, new_level;
164 if (
x !=
list->head && !
list->compare(
x->data, data)) {
175 new_level =
list->list_level;
176 if (x_level >
list->list_level) {
177 for (
i =
list->list_level + 1;
i <= x_level;
i++) {
190 for (
i = 0;
i <= x_level;
i++) {
195 list->list_level = new_level;
212 if (
x !=
list->head &&
list->compare(
x->data, data) == 0) {
227 for (
i =
list->list_level;
i >= 0;
i--) {
228 while (
x->forward[
i] !=
list->head &&
list->compare(
x->forward[
i]->data, data) <= 0) {
261 if (!
list ||
n < 0) {
275 return x ?
x->data :
NULL;
280 return x ?
x->data :
NULL;
285 return list->size == 0;
static bool update(RzCrypto *cry, const ut8 *buf, int len)
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 count
RZ_API void Ht_() free(HtName_(Ht) *ht)
static void freefn(HtName_(Ht) *ht, HT_(Kv) *kv)
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
void(* RzListFree)(void *ptr)
int(* RzListComparator)(const void *value, const void *list_data)
#define rz_skiplist_foreach(list, it, pos)
RZ_API void * rz_skiplist_get_n(RzSkipList *list, int n)
static RzSkipListNode * rz_skiplist_node_new(void *data, int level)
static void init_head(RzSkipListNode *head)
RZ_API bool rz_skiplist_delete_node(RzSkipList *list, RzSkipListNode *node)
RZ_API void * rz_skiplist_get_geq(RzSkipList *list, void *data)
RZ_API RzSkipListNode * rz_skiplist_find(RzSkipList *list, void *data)
RZ_API bool rz_skiplist_delete(RzSkipList *list, void *data)
RZ_API void * rz_skiplist_get_first(RzSkipList *list)
RZ_API void rz_skiplist_purge(RzSkipList *list)
static bool delete_element(RzSkipList *list, void *data, bool by_data)
RZ_API void * rz_skiplist_get_leq(RzSkipList *list, void *data)
RZ_API RzList * rz_skiplist_to_list(RzSkipList *list)
RZ_API RzSkipList * rz_skiplist_new(RzListFree freefn, RzListComparator comparefn)
RZ_API void rz_skiplist_join(RzSkipList *l1, RzSkipList *l2)
RZ_API RzSkipListNode * rz_skiplist_find_geq(RzSkipList *list, void *data)
static void rz_skiplist_node_free(RzSkipList *list, RzSkipListNode *node)
RZ_API RzSkipListNode * rz_skiplist_find_leq(RzSkipList *list, void *data)
#define SKIPLIST_MAX_DEPTH
static RzSkipListNode * find_insertpoint(RzSkipList *list, void *data, RzSkipListNode **updates, bool by_data)
RZ_API bool rz_skiplist_empty(RzSkipList *list)
RZ_API void rz_skiplist_free(RzSkipList *list)
RZ_API RzSkipListNode * rz_skiplist_insert(RzSkipList *list, void *data)
struct rz_skiplist_node_t ** forward