- nvpair_create_stringf: use the in-kernel vasprintf().
- Make nvlist_add_stringf() availabe in the kernel.
This commit is contained in:
parent
8ad10c91e9
commit
ac03b3fba2
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nv.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */
|
||||
/* $NetBSD: nv.h,v 1.3 2019/07/23 00:49:16 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -152,9 +152,7 @@ void nvlist_add_bool(nvlist_t *nvl, const char *name, bool value);
|
|||
void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value);
|
||||
void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value);
|
||||
void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4);
|
||||
#if !defined(_KERNEL) || defined(_VA_LIST_DECLARED)
|
||||
void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0);
|
||||
#endif
|
||||
void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value);
|
||||
void nvlist_add_binary(nvlist_t *nvl, const char *name, const void *value, size_t size);
|
||||
void nvlist_add_bool_array(nvlist_t *nvl, const char *name, const bool *value, size_t nitems);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $ */
|
||||
/* $NetBSD: nvlist.c,v 1.8 2019/07/23 00:49:16 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
|
@ -36,7 +36,7 @@
|
|||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $");
|
||||
#else
|
||||
__RCSID("$NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $");
|
||||
__RCSID("$NetBSD: nvlist.c,v 1.8 2019/07/23 00:49:16 rmind Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -1507,7 +1507,7 @@ nvlist_add_nvpair(nvlist_t *nvl, const nvpair_t *nvp)
|
|||
nvpair_insert(&nvl->nvl_head, newnvp, nvl);
|
||||
}
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(__NetBSD__)
|
||||
#if !defined(_STANDALONE)
|
||||
void
|
||||
nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $ */
|
||||
/* $NetBSD: nvpair.c,v 1.7 2019/07/23 00:49:16 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
|
@ -36,7 +36,7 @@
|
|||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $");
|
||||
#else
|
||||
__RCSID("$NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $");
|
||||
__RCSID("$NetBSD: nvpair.c,v 1.7 2019/07/23 00:49:16 rmind Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -1191,7 +1191,7 @@ nvpair_name(const nvpair_t *nvp)
|
|||
return (nvp->nvp_name);
|
||||
}
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(__NetBSD__)
|
||||
#if !defined(_STANDALONE)
|
||||
nvpair_t *
|
||||
nvpair_create_stringf(const char *name, const char *valuefmt, ...)
|
||||
{
|
||||
|
@ -1212,7 +1212,7 @@ nvpair_create_stringv(const char *name, const char *valuefmt, va_list valueap)
|
|||
char *str;
|
||||
int len;
|
||||
|
||||
len = nv_vasprintf(&str, valuefmt, valueap);
|
||||
len = vasprintf(&str, valuefmt, valueap);
|
||||
if (len < 0)
|
||||
return (NULL);
|
||||
nvp = nvpair_create_string(name, str);
|
||||
|
|
Loading…
Reference in New Issue