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

Function nvpair_create_bool_array

freebsd/contrib/libnv/bsd_nvpair.c:1319–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319nvpair_t *
1320nvpair_create_bool_array(const char *name, const bool *value, size_t nitems)
1321{
1322 nvpair_t *nvp;
1323 size_t size;
1324 void *data;
1325
1326 if (value == NULL || nitems == 0) {
1327 ERRNO_SET(EINVAL);
1328 return (NULL);
1329 }
1330
1331 size = sizeof(value[0]) * nitems;
1332 data = nv_malloc(size);
1333 if (data == NULL)
1334 return (NULL);
1335
1336 memcpy(data, value, size);
1337 nvp = nvpair_allocv(name, NV_TYPE_BOOL_ARRAY, (uint64_t)(uintptr_t)data,
1338 size, nitems);
1339 if (nvp == NULL) {
1340 ERRNO_SAVE();
1341 nv_free(data);
1342 ERRNO_RESTORE();
1343 }
1344
1345 return (nvp);
1346}
1347
1348nvpair_t *
1349nvpair_create_number_array(const char *name, const uint64_t *value,

Callers 1

nvpair_cloneFunction · 0.85

Calls 2

nvpair_allocvFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected