Index: head/sys/contrib/libnv/nvlist.c =================================================================== --- head/sys/contrib/libnv/nvlist.c +++ head/sys/contrib/libnv/nvlist.c @@ -707,15 +707,17 @@ static int * nvlist_xdescriptors(const nvlist_t *nvl, int *descs) { + void *cookie; nvpair_t *nvp; int type; NVLIST_ASSERT(nvl); PJDLOG_ASSERT(nvl->nvl_error == 0); - nvp = NULL; + cookie = NULL; do { - while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) { + while (nvlist_next(nvl, &type, &cookie) != NULL) { + nvp = cookie; switch (type) { case NV_TYPE_DESCRIPTOR: *descs = nvpair_get_descriptor(nvp); @@ -737,7 +739,7 @@ } case NV_TYPE_NVLIST: nvl = nvpair_get_nvlist(nvp); - nvp = NULL; + cookie = NULL; break; case NV_TYPE_NVLIST_ARRAY: { @@ -749,12 +751,12 @@ PJDLOG_ASSERT(nitems > 0); nvl = value[0]; - nvp = NULL; + cookie = NULL; break; } } } - } while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL); + } while ((nvl = nvlist_get_pararr(nvl, &cookie)) != NULL); return (descs); } @@ -784,6 +786,7 @@ nvlist_ndescriptors(const nvlist_t *nvl) { #ifndef _KERNEL + void *cookie; nvpair_t *nvp; size_t ndescs; int type; @@ -792,16 +795,17 @@ PJDLOG_ASSERT(nvl->nvl_error == 0); ndescs = 0; - nvp = NULL; + cookie = NULL; do { - while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) { + while (nvlist_next(nvl, &type, &cookie) != NULL) { + nvp = cookie; switch (type) { case NV_TYPE_DESCRIPTOR: ndescs++; break; case NV_TYPE_NVLIST: nvl = nvpair_get_nvlist(nvp); - nvp = NULL; + cookie = NULL; break; case NV_TYPE_NVLIST_ARRAY: { @@ -813,7 +817,7 @@ PJDLOG_ASSERT(nitems > 0); nvl = value[0]; - nvp = NULL; + cookie = NULL; break; } case NV_TYPE_DESCRIPTOR_ARRAY: @@ -827,7 +831,7 @@ } } } - } while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL); + } while ((nvl = nvlist_get_pararr(nvl, &cookie)) != NULL); return (ndescs); #else