Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src add a function to check if a tree is empty.
details: https://anonhg.NetBSD.org/src/rev/0307ff44dfa9
branches: trunk
changeset: 770363:0307ff44dfa9
user: yamt <yamt%NetBSD.org@localhost>
date: Fri Oct 14 15:16:59 2011 +0000
description:
add a function to check if a tree is empty.
diffstat:
common/lib/libc/gen/radixtree.c | 13 ++++++++++---
sys/sys/radixtree.h | 3 ++-
2 files changed, 12 insertions(+), 4 deletions(-)
diffs (58 lines):
diff -r d0d8598c99b2 -r 0307ff44dfa9 common/lib/libc/gen/radixtree.c
--- a/common/lib/libc/gen/radixtree.c Fri Oct 14 15:15:27 2011 +0000
+++ b/common/lib/libc/gen/radixtree.c Fri Oct 14 15:16:59 2011 +0000
@@ -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 @@
#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 @@
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)
{
diff -r d0d8598c99b2 -r 0307ff44dfa9 sys/sys/radixtree.h
--- a/sys/sys/radixtree.h Fri Oct 14 15:15:27 2011 +0000
+++ b/sys/sys/radixtree.h Fri Oct 14 15:16:59 2011 +0000
@@ -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_tree(struct radix_tree *);
void radix_tree_fini_tree(struct radix_tree *);
+bool radix_tree_empty_tree_p(struct radix_tree *);
/*
* node
Home |
Main Index |
Thread Index |
Old Index