Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/libnv/dist libnv: add a wrapper around free...
details: https://anonhg.NetBSD.org/src/rev/9063bbd47212
branches: trunk
changeset: 433606:9063bbd47212
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Sep 23 19:07:10 2018 +0000
description:
libnv: add a wrapper around free(9) since in FreeBSD it can take NULL.
diffstat:
sys/external/bsd/libnv/dist/nv_impl.h | 5 +++--
sys/external/bsd/libnv/dist/nv_kern_netbsd.c | 13 +++++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diffs (56 lines):
diff -r fea783757f5c -r 9063bbd47212 sys/external/bsd/libnv/dist/nv_impl.h
--- a/sys/external/bsd/libnv/dist/nv_impl.h Sun Sep 23 15:28:48 2018 +0000
+++ b/sys/external/bsd/libnv/dist/nv_impl.h Sun Sep 23 19:07:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nv_impl.h,v 1.4 2018/09/22 17:13:30 rmind Exp $ */
+/* $NetBSD: nv_impl.h,v 1.5 2018/09/23 19:07:10 rmind Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -65,10 +65,11 @@
# endif
# define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \
M_WAITOK)
-# define nv_free(buf) free((buf), M_NVLIST)
# ifdef __FreeBSD__
+# define nv_free(buf) free((buf), M_NVLIST)
# define nv_strdup(buf) strdup((buf), M_NVLIST)
# else
+extern void nv_free(void *);
extern char *nv_strdup(const char *);
# endif
# define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__)
diff -r fea783757f5c -r 9063bbd47212 sys/external/bsd/libnv/dist/nv_kern_netbsd.c
--- a/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Sun Sep 23 15:28:48 2018 +0000
+++ b/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Sun Sep 23 19:07:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $ */
+/* $NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $");
+__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $");
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <sys/mman.h>
@@ -61,6 +61,15 @@
#ifndef _STANDALONE
#ifdef _KERNEL
+void
+nv_free(void *buf)
+{
+ if (!buf) {
+ return;
+ }
+ free(buf, M_NVLIST);
+}
+
int
nvlist_copyin(const nvlist_ref_t *nref, nvlist_t **nvlp, size_t lim)
{
Home |
Main Index |
Thread Index |
Old Index