nginx/src/core/ngx_rbtree.h

38 lines
804 B
C
Raw Normal View History

2003-12-04 22:53:00 +08:00
#ifndef _NGX_RBTREE_H_INCLUDED_
#define _NGX_RBTREE_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
typedef struct ngx_rbtree_s ngx_rbtree_t;
struct ngx_rbtree_s {
ngx_int_t key;
ngx_rbtree_t *left;
ngx_rbtree_t *right;
ngx_rbtree_t *parent;
2003-12-05 15:11:46 +08:00
char color;
2003-12-04 22:53:00 +08:00
};
2003-12-06 01:07:27 +08:00
void ngx_rbtree_insert(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
ngx_rbtree_t *node);
void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
ngx_rbtree_t *node);
2003-12-04 22:53:00 +08:00
2003-12-09 23:08:11 +08:00
ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *node,
2003-12-06 01:07:27 +08:00
ngx_rbtree_t *sentinel)
2003-12-04 22:53:00 +08:00
{
2003-12-09 23:08:11 +08:00
while (node->left != sentinel) {
node = node->left;
2003-12-04 22:53:00 +08:00
}
2003-12-09 23:08:11 +08:00
return node;
2003-12-04 22:53:00 +08:00
}
#endif /* _NGX_RBTREE_H_INCLUDED_ */