Print this page
6447 handful of nvpair cleanups

Split Close
Expand all
Collapse all
          --- old/usr/src/common/nvpair/nvpair.c
          +++ new/usr/src/common/nvpair/nvpair.c
↓ open down ↓ 1617 lines elided ↑ open up ↑
1618 1618          int             n;
1619 1619  
1620 1620          if (ip)
1621 1621                  *ip = -1;                       /* not indexed */
1622 1622          if (ep)
1623 1623                  *ep = NULL;
1624 1624  
1625 1625          if ((nvl == NULL) || (name == NULL))
1626 1626                  return (EINVAL);
1627 1627  
     1628 +        sepp = NULL;
     1629 +        idx = 0;
1628 1630          /* step through components of name */
1629 1631          for (np = name; np && *np; np = sepp) {
1630 1632                  /* ensure unique names */
1631 1633                  if (!(nvl->nvl_nvflag & NV_UNIQUE_NAME))
1632 1634                          return (ENOTSUP);
1633 1635  
1634 1636                  /* skip white space */
1635 1637                  skip_whitespace(np);
1636 1638                  if (*np == 0)
1637 1639                          break;
↓ open down ↓ 737 lines elided ↑ open up ↑
2375 2377           *    these properties.
2376 2378           * 2. When using nvlist_pack() the user can specify his own
2377 2379           *    allocator properties (e.g. by using KM_NOSLEEP).
2378 2380           *
2379 2381           * We use the user specified properties (2). A clearer solution
2380 2382           * will be to remove the kmflag from nvlist_pack(), but we will
2381 2383           * not change the interface.
2382 2384           */
2383 2385          nv_priv_init(&nvpriv, nva, 0);
2384 2386  
2385      -        if (err = nvlist_size(nvl, &alloc_size, encoding))
     2387 +        if ((err = nvlist_size(nvl, &alloc_size, encoding)))
2386 2388                  return (err);
2387 2389  
2388 2390          if ((buf = nv_mem_zalloc(&nvpriv, alloc_size)) == NULL)
2389 2391                  return (ENOMEM);
2390 2392  
2391 2393          if ((err = nvlist_common(nvl, buf, &alloc_size, encoding,
2392 2394              NVS_OP_ENCODE)) != 0) {
2393 2395                  nv_mem_free(&nvpriv, buf, alloc_size);
2394 2396          } else {
2395 2397                  *buflen = alloc_size;
↓ open down ↓ 902 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX