History log of /freebsd-11-stable/sys/contrib/libnv/nvlist.c
Revision Date Author Comments
# 346905 29-Apr-2019 oshogbo

MFC r346112:
libnv: fix compilation warnings

When building libnv without a debug those arguments are no longer used
because assertions will be changed to NOP.

Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>

MFC r346115:
The nvlist_report_missing is also used by the cnvlist.
It can't be a static one.

Reported by: jenkins


# 336346 16-Jul-2018 kevans

MFC r304910, r304912, r304915, r304952, r325019, r328164, r331094, r332664,
r335341-r335345, r335347, r335379-r335380, r335382

r304910:
Introduce cnv man page.

r304912:
Add missed header file for cnv.h .

r304915:
Bump date in the man page.

r304952:
Remove duplicated declaration.

r325019:
Introduce cnvlist_name() and cnvlist_type() functions.

Those function can be used when we are iterating over nvlist to reduce
amount of extra variables we need to declare.

r328164:
libnv: Use mallocarray(9) for the nv_calloc.

r331094:
Fix formatting errors that resulted in apropos(1) output looking weird.

r332664:
Add missing argument in the cnv man page.

r335341:
libnv: change name of cookie from cookiep to cookie.

The name was inconsistent with rest of the library.
No functional change intended.

r335342:
libnv: add const to cookies arguments

r335343:
libnv: Remove nvlist argument from cnvlist_{take,free}_* functions.

All information which are need for those operations is already stored in
the cookie.

We decided not to bump libnv version because this API is not used yet in the
base system.

r335344:
libnv: clean parent in nvlist_array when removing it.

When we are removing element form the nvlist we should also clean parent,
because the array is not a part of the nvlist anymore.

r335345:
libnv: add regression test for r335344.

r335347:
libnv: Add nvlist_append_*_array() family of functions.

The nvlist_append_{bool,number,string,nvlist,descriptor}_array() functions
allows to dynamically extend array stored in the nvlist.

r335379:
Set prev to NULL so its garaunteed to have a value of some kind and
gcc doesn't explode. Feel free to fix this correctly or whatever for
gcc builds.

This *should* quiesce tinderbox after r335347 for the gcc builds.

r335380:
style(9) fix, I was also going to silence gcc.

r335382:
Really fix the style.


# 336345 16-Jul-2018 kevans

MFC r304908-r304909

r304908:
Add cnv API.

cnv API is a set of functions for managing name/value pairs by cookie.
The cookie can be obtained by nvlist_next(), nvlist_get_parent() or
nvlist_get_pararr() function. This patch also includes unit tests.

Submitted by: Adam Starak <starak.adam@gmail.com>

r304909:
Fix style issue in the cnv API.
Remove unused arguments in a macro.
Remove unused typedef.


# 325372 03-Nov-2017 jilles

MFC r325017: libnv: Fix strict-aliasing violation with cookie

In r323851 (MFC'ed to stable/11 as r324831), some casts were adjusted in
calls to nvlist_next() and nvlist_get_pararr() in order to make scan-build
happy. I think these changes just confused scan-build into not reporting
the strict-aliasing violation.

For example, nvlist_xdescriptors() is causing nvlist_next() to write to its
local variable nvp of type nvpair_t * using the lvalue *cookiep of type
void *, which is not allowed. Given the APIs of nvlist_next(),
nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a
local void *cookie in nvlist_xdescriptors() and other places, and to convert
the value to nvpair_t * when necessary. This patch implements that fix.


# 324831 21-Oct-2017 oshogbo

MFC r323851:
Remove redundant initialization. Don't use variable - just return the value.
Make scan-build happy by casting to 'void *' instead of 'void **'.

Submitted by: pjd@
Found by: scan-build and cppcheck
Sponsored by: Wheel Systems


# 324829 21-Oct-2017 oshogbo

MFC r323853:
Make the code consistent by always using 'fail' label.

Submitted by: pjd@ and oshogbo@
Sponsored by: Wheel Systems


# 324828 21-Oct-2017 oshogbo

MFC r323852:
The 'while (array != NULL) { }' suggests scan-build that array may be
initially NULL, which is not possible. Change the loop to
'do {} while (array != NULL)' to satisfy scan-build and assert that
array really cannot be NULL just in case.

Submitted by: pjd@
Found by: scan-build
MFC after: 1 month
Sponsored by: Wheel Systems


# 303826 08-Aug-2016 oshogbo

MFC r302966:
Fix nvlist array memory leak.

When we change nvl_array_next to NULL it means that we want to destroy
or take nvlist_array. The nvpair, which stores next nvlist of
nvlist_array element is no longer needed and can be freed.

Submitted by: Adam Starak <starak.adam@gmail.com>
Approved by: re (gjb)