Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/gen fix _STANDALONE build



details:   https://anonhg.NetBSD.org/src/rev/55f92b44b440
branches:  trunk
changeset: 764544:55f92b44b440
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Apr 26 20:53:34 2011 +0000

description:
fix _STANDALONE build

diffstat:

 common/lib/libc/gen/radixtree.c |  36 ++++++++++++++++++++++++++++--------
 common/lib/libc/gen/rpst.c      |  10 +++++++---
 2 files changed, 35 insertions(+), 11 deletions(-)

diffs (109 lines):

diff -r 246bce430c1b -r 55f92b44b440 common/lib/libc/gen/radixtree.c
--- a/common/lib/libc/gen/radixtree.c   Tue Apr 26 20:42:01 2011 +0000
+++ b/common/lib/libc/gen/radixtree.c   Tue Apr 26 20:53:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $       */
+/*     $NetBSD: radixtree.c,v 1.3 2011/04/26 20:53:53 yamt Exp $       */
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -41,13 +41,17 @@
 #include <sys/cdefs.h>
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.3 2011/04/26 20:53:53 yamt Exp $");
 #include <sys/param.h>
-#include <sys/null.h>
+#include <sys/errno.h>
 #include <sys/pool.h>
 #include <sys/radixtree.h>
+#include <lib/libkern/libkern.h>
+#if defined(_STANDALONE)
+#include <lib/libsa/stand.h>
+#endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.3 2011/04/26 20:53:53 yamt Exp $");
 #include <assert.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -204,6 +208,13 @@
        KASSERT(t->t_height == 0);
 }
 
+static void
+radix_tree_node_init(struct radix_tree_node *n)
+{
+
+       memset(n, 0, sizeof(*n));
+}
+
 #if defined(_KERNEL)
 pool_cache_t radix_tree_node_cache __read_mostly;
 
@@ -213,7 +224,7 @@
        struct radix_tree_node *n = item;
 
        KASSERT(dummy == NULL);
-       memset(n, 0, sizeof(*n));
+       radix_tree_node_init(n);
        return 0;
 }
 
@@ -258,7 +269,14 @@
 #if defined(_KERNEL)
        n = pool_cache_get(radix_tree_node_cache, PR_NOWAIT);
 #else /* defined(_KERNEL) */
-       n = calloc(1, sizeof(*n));
+#if defined(_STANDALONE)
+       n = alloc(sizeof(*n));
+#else /* defined(_STANDALONE) */
+       n = malloc(sizeof(*n));
+#endif /* defined(_STANDALONE) */
+       if (n != NULL) {
+               radix_tree_node_init(n);
+       }
 #endif /* defined(_KERNEL) */
        KASSERT(n == NULL || radix_tree_node_clean_p(n));
        return n;
@@ -271,9 +289,11 @@
        KASSERT(radix_tree_node_clean_p(n));
 #if defined(_KERNEL)
        pool_cache_put(radix_tree_node_cache, n);
-#else /* defined(_KERNEL) */
+#elif defined(_STANDALONE)
+       dealloc(n, sizeof(*n));
+#else
        free(n);
-#endif /* defined(_KERNEL) */
+#endif
 }
 
 static int
diff -r 246bce430c1b -r 55f92b44b440 common/lib/libc/gen/rpst.c
--- a/common/lib/libc/gen/rpst.c        Tue Apr 26 20:42:01 2011 +0000
+++ b/common/lib/libc/gen/rpst.c        Tue Apr 26 20:53:34 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $   */
+/*     $NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $   */
 
 /*-
  * Copyright (c)2009 YAMAMOTO Takashi,
@@ -43,10 +43,14 @@
 #include <sys/cdefs.h>
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $");
 #include <sys/param.h>
+#include <lib/libkern/libkern.h>
+#if defined(_STANDALONE)
+#include <lib/libsa/stand.h>
+#endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $");
+__RCSID("$NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $");
 #include <assert.h>
 #include <stdbool.h>
 #include <string.h>



Home | Main Index | Thread Index | Old Index