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

Function nvpair_create_string

freebsd/contrib/libnv/bsd_nvpair.c:1223–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1221}
1222
1223nvpair_t *
1224nvpair_create_string(const char *name, const char *value)
1225{
1226 nvpair_t *nvp;
1227 size_t size;
1228 char *data;
1229
1230 if (value == NULL) {
1231 ERRNO_SET(EINVAL);
1232 return (NULL);
1233 }
1234
1235 data = nv_strdup(value);
1236 if (data == NULL)
1237 return (NULL);
1238 size = strlen(value) + 1;
1239
1240 nvp = nvpair_allocv(name, NV_TYPE_STRING, (uint64_t)(uintptr_t)data,
1241 size, 0);
1242 if (nvp == NULL)
1243 nv_free(data);
1244
1245 return (nvp);
1246}
1247
1248nvpair_t *
1249nvpair_create_nvlist(const char *name, const nvlist_t *value)

Callers 2

nvpair_cloneFunction · 0.85
nvpair_create_stringvFunction · 0.85

Calls 1

nvpair_allocvFunction · 0.85

Tested by

no test coverage detected