MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nvlist_clone

Function nvlist_clone

freebsd/contrib/libnv/nvlist.c:394–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394nvlist_t *
395nvlist_clone(const nvlist_t *nvl)
396{
397 nvlist_t *newnvl;
398 nvpair_t *nvp, *newnvp;
399
400 NVLIST_ASSERT(nvl);
401
402 if (nvl->nvl_error != 0) {
403 ERRNO_SET(nvl->nvl_error);
404 return (NULL);
405 }
406
407 newnvl = nvlist_create(nvl->nvl_flags & NV_FLAG_PUBLIC_MASK);
408 for (nvp = nvlist_first_nvpair(nvl); nvp != NULL;
409 nvp = nvlist_next_nvpair(nvl, nvp)) {
410 newnvp = nvpair_clone(nvp);
411 if (newnvp == NULL)
412 break;
413 (void)nvlist_move_nvpair(newnvl, newnvp);
414 }
415 if (nvp != NULL) {
416 nvlist_destroy(newnvl);
417 return (NULL);
418 }
419 return (newnvl);
420}
421
422#ifndef _KERNEL
423static bool

Callers 3

nvpair_create_nvlistFunction · 0.85

Calls 5

nvlist_createFunction · 0.85
nvlist_first_nvpairFunction · 0.85
nvpair_cloneFunction · 0.85
nvlist_destroyFunction · 0.85
nvlist_next_nvpairFunction · 0.70

Tested by

no test coverage detected