void nvlist_free_type(nvlist_t *nvl, const char *name, int type) { nvpair_t *nvp; NVLIST_ASSERT(nvl); PJDLOG_ASSERT(nvl->nvl_error == 0); PJDLOG_ASSERT(type == NV_TYPE_NONE || (type >= NV_TYPE_FIRST && type <= NV_TYPE_LAST)); nvp = nvlist_find(nvl, type, name); if (nvp != NULL) nvlist_free_nvpair(nvl, nvp); else nvlist_report_missing(type, name); }
void nvlist_freev_type(nvlist_t *nvl, int type, const char *namefmt, va_list nameap) { va_list cnameap; nvpair_t *nvp; NVLIST_ASSERT(nvl); PJDLOG_ASSERT(nvl->nvl_error == 0); PJDLOG_ASSERT(type == NV_TYPE_NONE || (type >= NV_TYPE_FIRST && type <= NV_TYPE_LAST)); va_copy(cnameap, nameap); nvp = nvlist_findv(nvl, type, namefmt, cnameap); va_end(cnameap); if (nvp != NULL) nvlist_free_nvpair(nvl, nvp); else nvlist_report_missing(type, namefmt, nameap); }