diff options
author | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2015-08-11 17:41:32 +0000 |
---|---|---|
committer | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2015-08-11 17:41:32 +0000 |
commit | 89ca10c6e26987bcbc0bbc162887fb5409e3441b (patch) | |
tree | 8fd637b0318e4d948d4dfeb6cafc93f0bd9d6c33 /sys/contrib/libnv | |
parent | 643ef281cd4e8e9c00df95ba4c4ae2598bf9743f (diff) | |
download | src-89ca10c6e26987bcbc0bbc162887fb5409e3441b.tar.gz src-89ca10c6e26987bcbc0bbc162887fb5409e3441b.zip |
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)
Notes
Notes:
svn path=/head/; revision=286642
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 3138001eab4b..cdb54d28f484 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)); } |