diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-02-12 20:55:26 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-02-12 20:55:26 +0400 |
commit | 7acd59db885896d5819cdef30d630901c1344e1f (patch) | |
tree | dae09c3097b06cd421275dd53942d803f69e8176 /usr | |
parent | 41cd358da4f8be41075c6539a7428fc09558f104 (diff) | |
download | libsunavl-upstream/1.0.tar.gz |
Imported Upstream version 1.0upstream/1.0
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/common/avl/avl.c | 28 | ||||
-rw-r--r-- | usr/src/uts/common/sys/avl.h | 22 | ||||
-rw-r--r-- | usr/src/uts/common/sys/avl_impl.h | 12 |
3 files changed, 32 insertions, 30 deletions
diff --git a/usr/src/common/avl/avl.c b/usr/src/common/avl/avl.c index dd39c12..00cf2fa 100644 --- a/usr/src/common/avl/avl.c +++ b/usr/src/common/avl/avl.c @@ -87,11 +87,19 @@ * than the value of the indicated "avl_node_t *". */ -#include <sys/types.h> -#include <sys/param.h> -#include <sys/debug.h> -#include <sys/avl.h> -#include <sys/cmn_err.h> +#ifndef ASSERT +# include <assert.h> +# define ASSERT assert +#endif + +#define B_TRUE (1) +#define B_FALSE (0) + +#include <stddef.h> +#include <inttypes.h> + +#include "avl_impl.h" +#include "avl.h" /* * Small arrays to translate between balance (or diff) values and child indeces. @@ -809,7 +817,7 @@ avl_remove(avl_tree_t *tree, void *data) avl_remove((tree), (obj)); \ avl_add((tree), (obj)) -boolean_t +int avl_update_lt(avl_tree_t *t, void *obj) { void *neighbor; @@ -826,7 +834,7 @@ avl_update_lt(avl_tree_t *t, void *obj) return (B_FALSE); } -boolean_t +int avl_update_gt(avl_tree_t *t, void *obj) { void *neighbor; @@ -843,7 +851,7 @@ avl_update_gt(avl_tree_t *t, void *obj) return (B_FALSE); } -boolean_t +int avl_update(avl_tree_t *t, void *obj) { void *neighbor; @@ -901,14 +909,14 @@ avl_destroy(avl_tree_t *tree) /* * Return the number of nodes in an AVL tree. */ -ulong_t +size_t avl_numnodes(avl_tree_t *tree) { ASSERT(tree); return (tree->avl_numnodes); } -boolean_t +int avl_is_empty(avl_tree_t *tree) { ASSERT(tree); diff --git a/usr/src/uts/common/sys/avl.h b/usr/src/uts/common/sys/avl.h index ba305c9..d7f0341 100644 --- a/usr/src/uts/common/sys/avl.h +++ b/usr/src/uts/common/sys/avl.h @@ -23,8 +23,8 @@ * Use is subject to license terms. */ -#ifndef _AVL_H -#define _AVL_H +#ifndef _LIBSUNAVL_AVL_H +#define _LIBSUNAVL_AVL_H /* * This is a private header file. Applications should not directly include @@ -35,9 +35,6 @@ extern "C" { #endif -#include <sys/types.h> -#include <sys/avl_impl.h> - /* * This is a generic implemenatation of AVL trees for use in the Solaris kernel. * The interfaces provide an efficient way of implementing an ordered set of @@ -255,19 +252,19 @@ extern void avl_remove(avl_tree_t *tree, void *node); * avl_update_gt() only if you know the direction in which the order of the * node may change. */ -extern boolean_t avl_update(avl_tree_t *, void *); -extern boolean_t avl_update_lt(avl_tree_t *, void *); -extern boolean_t avl_update_gt(avl_tree_t *, void *); +extern int avl_update(avl_tree_t *, void *); +extern int avl_update_lt(avl_tree_t *, void *); +extern int avl_update_gt(avl_tree_t *, void *); /* * Return the number of nodes in the tree */ -extern ulong_t avl_numnodes(avl_tree_t *tree); +extern size_t avl_numnodes(avl_tree_t *tree); /* - * Return B_TRUE if there are zero nodes in the tree, B_FALSE otherwise. + * Return 1 if there are zero nodes in the tree, 0 otherwise. */ -extern boolean_t avl_is_empty(avl_tree_t *tree); +extern int avl_is_empty(avl_tree_t *tree); /* * Used to destroy any remaining nodes in a tree. The cookie argument should @@ -306,4 +303,5 @@ extern void avl_destroy(avl_tree_t *tree); } #endif -#endif /* _AVL_H */ +#endif /* _LIBSUNAVL_AVL_H */ + diff --git a/usr/src/uts/common/sys/avl_impl.h b/usr/src/uts/common/sys/avl_impl.h index 620685f..6a2cc08 100644 --- a/usr/src/uts/common/sys/avl_impl.h +++ b/usr/src/uts/common/sys/avl_impl.h @@ -24,18 +24,14 @@ * Use is subject to license terms. */ -#ifndef _AVL_IMPL_H -#define _AVL_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" +#ifndef _LIBSUNAVL_AVL_IMPL_H +#define _LIBSUNAVL_AVL_IMPL_H /* * This is a private header file. Applications should not directly include * this file. */ -#include <sys/types.h> - #ifdef __cplusplus extern "C" { #endif @@ -147,7 +143,7 @@ struct avl_tree { struct avl_node *avl_root; /* root node in tree */ int (*avl_compar)(const void *, const void *); size_t avl_offset; /* offsetof(type, avl_link_t field) */ - ulong_t avl_numnodes; /* number of nodes in the tree */ + size_t avl_numnodes; /* number of nodes in the tree */ size_t avl_size; /* sizeof user type struct */ }; @@ -161,4 +157,4 @@ extern void *avl_walk(struct avl_tree *, void *, int); } #endif -#endif /* _AVL_IMPL_H */ +#endif /* _LIBSUNAVL_AVL_IMPL_H */ |