Module Name: src
Committed By: yamt
Date: Fri Oct 14 15:16:59 UTC 2011
Modified Files:
src/common/lib/libc/gen: radixtree.c
src/sys/sys: radixtree.h
Log Message:
add a function to check if a tree is empty.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/gen/radixtree.c
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/radixtree.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.8 src/common/lib/libc/gen/radixtree.c:1.9
--- src/common/lib/libc/gen/radixtree.c:1.8 Fri Oct 14 15:15:27 2011
+++ src/common/lib/libc/gen/radixtree.c Fri Oct 14 15:16:59 2011
@@ -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,
#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 *
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)
{
Index: src/sys/sys/radixtree.h
diff -u src/sys/sys/radixtree.h:1.2 src/sys/sys/radixtree.h:1.3
--- src/sys/sys/radixtree.h:1.2 Thu Apr 14 15:34:43 2011
+++ src/sys/sys/radixtree.h Fri Oct 14 15:16:59 2011
@@ -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