diff options
author | oshogbo <oshogbo@FreeBSD.org> | 2015-08-11 17:41:32 +0000 |
---|---|---|
committer | oshogbo <oshogbo@FreeBSD.org> | 2015-08-11 17:41:32 +0000 |
commit | d2f6c2a9e32cd71d8a617018ffdd728fe1ea24a2 (patch) | |
tree | 8fd637b0318e4d948d4dfeb6cafc93f0bd9d6c33 /sys/contrib/libnv | |
parent | 8a5a3af09a730c4137b206e74dd59525cc3fef8b (diff) | |
download | FreeBSD-src-d2f6c2a9e32cd71d8a617018ffdd728fe1ea24a2.zip FreeBSD-src-d2f6c2a9e32cd71d8a617018ffdd728fe1ea24a2.tar.gz |
Make the nvlist_next(9) function handle NULL pointer variable.
This simplifies removing the first element from nvlist.
Reviewed by: AllanJude
Approved by: pjd (mentor)
Diffstat (limited to 'sys/contrib/libnv')
-rw-r--r-- | sys/contrib/libnv/nvlist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c index 3138001..cdb54d2 100644 --- a/sys/contrib/libnv/nvlist.c +++ b/sys/contrib/libnv/nvlist.c @@ -1026,9 +1026,8 @@ nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep) nvpair_t *nvp; NVLIST_ASSERT(nvl); - PJDLOG_ASSERT(cookiep != NULL); - if (*cookiep == NULL) + if (cookiep == NULL || *cookiep == NULL) nvp = nvlist_first_nvpair(nvl); else nvp = nvlist_next_nvpair(nvl, *cookiep); @@ -1036,7 +1035,8 @@ nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep) return (NULL); if (typep != NULL) *typep = nvpair_type(nvp); - *cookiep = nvp; + if (cookiep != NULL) + *cookiep = nvp; return (nvpair_name(nvp)); } |