summaryrefslogtreecommitdiff
path: root/src/splaytree.h
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@debian.org>2005-11-27 14:39:54 +0000
committerTorsten Marek <shlomme@debian.org>2005-11-27 14:39:54 +0000
commit701d5359518f46aadc89655d38ff91e6eae4496d (patch)
tree5e47b76785345f850e9d9d196461d66c3e8e8828 /src/splaytree.h
downloadlighttpd-701d5359518f46aadc89655d38ff91e6eae4496d.tar.gz
[svn-inject] Installing original source of lighttpd
Diffstat (limited to 'src/splaytree.h')
-rw-r--r--src/splaytree.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/splaytree.h b/src/splaytree.h
new file mode 100644
index 0000000..98e4234
--- /dev/null
+++ b/src/splaytree.h
@@ -0,0 +1,24 @@
+#ifndef _SPLAY_TREE_H_
+#define _SPLAY_TREE_H_
+
+typedef struct tree_node {
+ struct tree_node * left, * right;
+ int key;
+ int size; /* maintained to be the number of nodes rooted here */
+
+ void *data;
+} splay_tree;
+
+
+splay_tree * splaytree_splay (splay_tree *t, int key);
+splay_tree * splaytree_insert(splay_tree *t, int key, void *data);
+splay_tree * splaytree_delete(splay_tree *t, int key);
+splay_tree * splaytree_size(splay_tree *t);
+
+#define splaytree_size(x) (((x)==NULL) ? 0 : ((x)->size))
+/* This macro returns the size of a node. Unlike "x->size", */
+/* it works even if x=NULL. The test could be avoided by using */
+/* a special version of NULL which was a real node with size 0. */
+
+
+#endif