add a function to check if a tree is empty.
This commit is contained in:
parent
765c84955a
commit
c66560279a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: radixtree.c,v 1.8 2011/10/14 15:15:27 yamt Exp $ */
|
||||
/* $NetBSD: radixtree.c,v 1.9 2011/10/14 15:16:59 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2011 YAMAMOTO Takashi,
|
||||
@ -41,7 +41,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||
__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.8 2011/10/14 15:15:27 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.9 2011/10/14 15:16:59 yamt Exp $");
|
||||
#include <sys/param.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/pool.h>
|
||||
@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.8 2011/10/14 15:15:27 yamt Exp $");
|
||||
#include <lib/libsa/stand.h>
|
||||
#endif /* defined(_STANDALONE) */
|
||||
#else /* defined(_KERNEL) || defined(_STANDALONE) */
|
||||
__RCSID("$NetBSD: radixtree.c,v 1.8 2011/10/14 15:15:27 yamt Exp $");
|
||||
__RCSID("$NetBSD: radixtree.c,v 1.9 2011/10/14 15:16:59 yamt Exp $");
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
@ -217,6 +217,13 @@ radix_tree_fini_tree(struct radix_tree *t)
|
||||
KASSERT(t->t_height == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
radix_tree_empty_tree_p(struct radix_tree *t)
|
||||
{
|
||||
|
||||
return t->t_root == NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
radix_tree_node_init(struct radix_tree_node *n)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: radixtree.h,v 1.2 2011/04/14 15:34:43 yamt Exp $ */
|
||||
/* $NetBSD: radixtree.h,v 1.3 2011/10/14 15:16:59 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2011 YAMAMOTO Takashi,
|
||||
@ -55,6 +55,7 @@ void radix_tree_init(void);
|
||||
|
||||
void radix_tree_init_tree(struct radix_tree *);
|
||||
void radix_tree_fini_tree(struct radix_tree *);
|
||||
bool radix_tree_empty_tree_p(struct radix_tree *);
|
||||
|
||||
/*
|
||||
* node
|
||||
|
Loading…
Reference in New Issue
Block a user