diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2017-11-21 18:55:28 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2017-11-21 18:55:28 +0300 |
commit | 78a77c3e38593a5dd1ba0970d036ed5f5100f88d (patch) | |
tree | 3011f02b551c623a926e85ed1532986b947da300 /test/nxt_rbtree1.h | |
parent | 89a1c66dd0c396cda30a960e790817d28dc9a2de (diff) | |
download | unit-78a77c3e38593a5dd1ba0970d036ed5f5100f88d.tar.gz unit-78a77c3e38593a5dd1ba0970d036ed5f5100f88d.tar.bz2 |
Tests: move existing tests to "src" folder.
Diffstat (limited to 'test/nxt_rbtree1.h')
-rw-r--r-- | test/nxt_rbtree1.h | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/test/nxt_rbtree1.h b/test/nxt_rbtree1.h deleted file mode 100644 index 60048dad..00000000 --- a/test/nxt_rbtree1.h +++ /dev/null @@ -1,73 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) Nginx, Inc. - */ - - -typedef nxt_uint_t nxt_rbtree1_key_t; -typedef nxt_int_t nxt_rbtree1_key_int_t; - - -typedef struct nxt_rbtree1_node_s nxt_rbtree1_node_t; - -struct nxt_rbtree1_node_s { - nxt_rbtree1_key_t key; - nxt_rbtree1_node_t *left; - nxt_rbtree1_node_t *right; - nxt_rbtree1_node_t *parent; - u_char color; - u_char data; -}; - - -typedef struct nxt_rbtree1_s nxt_rbtree1_t; - -typedef void (*nxt_rbtree1_insert_pt) (nxt_rbtree1_node_t *root, - nxt_rbtree1_node_t *node, nxt_rbtree1_node_t *sentinel); - -struct nxt_rbtree1_s { - nxt_rbtree1_node_t *root; - nxt_rbtree1_node_t *sentinel; - nxt_rbtree1_insert_pt insert; -}; - - -#define nxt_rbtree1_init(tree, s, i) \ - nxt_rbtree1_sentinel_init(s); \ - (tree)->root = s; \ - (tree)->sentinel = s; \ - (tree)->insert = i - - -NXT_EXPORT void nxt_rbtree1_insert(nxt_rbtree1_t *tree, - nxt_rbtree1_node_t *node); -NXT_EXPORT void nxt_rbtree1_delete(nxt_rbtree1_t *tree, - nxt_rbtree1_node_t *node); -NXT_EXPORT void nxt_rbtree1_insert_value(nxt_rbtree1_node_t *root, - nxt_rbtree1_node_t *node, nxt_rbtree1_node_t *sentinel); -NXT_EXPORT void nxt_rbtree1_insert_timer_value(nxt_rbtree1_node_t *root, - nxt_rbtree1_node_t *node, nxt_rbtree1_node_t *sentinel); - - -#define nxt_rbtree1_red(node) ((node)->color = 1) -#define nxt_rbtree1_black(node) ((node)->color = 0) -#define nxt_rbtree1_is_red(node) ((node)->color) -#define nxt_rbtree1_is_black(node) (!nxt_rbtree1_is_red(node)) -#define nxt_rbtree1_copy_color(n1, n2) (n1->color = n2->color) - - -/* a sentinel must be black */ - -#define nxt_rbtree1_sentinel_init(node) nxt_rbtree1_black(node) - - -nxt_inline nxt_rbtree1_node_t * -nxt_rbtree1_min(nxt_rbtree1_node_t *node, nxt_rbtree1_node_t *sentinel) -{ - while (node->left != sentinel) { - node = node->left; - } - - return node; -} |