nginx-quic/src/core/ngx_rbtree.h

48 lines
865 B
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
2003-12-04 11:53:00 -03:00
#ifndef _NGX_RBTREE_H_INCLUDED_
#define _NGX_RBTREE_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
typedef ngx_uint_t ngx_rbtree_key_t;
typedef ngx_int_t ngx_rbtree_key_int_t;
2003-12-04 11:53:00 -03:00
typedef struct ngx_rbtree_s ngx_rbtree_t;
struct ngx_rbtree_s {
ngx_rbtree_key_t key;
ngx_rbtree_t *left;
ngx_rbtree_t *right;
ngx_rbtree_t *parent;
char color;
2003-12-04 11:53:00 -03:00
};
2003-12-05 14:07:27 -03:00
void ngx_rbtree_insert(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
ngx_rbtree_t *node);
2003-12-05 14:07:27 -03:00
void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
ngx_rbtree_t *node);
2003-12-04 11:53:00 -03:00
static ngx_inline ngx_rbtree_t *
ngx_rbtree_min(ngx_rbtree_t *node, ngx_rbtree_t *sentinel)
2003-12-04 11:53:00 -03:00
{
while (node->left != sentinel) {
node = node->left;
}
2003-12-04 11:53:00 -03:00
return node;
2003-12-04 11:53:00 -03:00
}
#endif /* _NGX_RBTREE_H_INCLUDED_ */