Skip to content

Commit

Permalink
6447 handful of nvpair cleanups
Browse files Browse the repository at this point in the history
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Robert Mustacchi <rm@joyent.com>
  • Loading branch information
Thynix authored and rmustacc committed Nov 17, 2015
1 parent 68ecb2e commit 759e89b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion usr/src/common/nvpair/nvpair.c
Expand Up @@ -1626,6 +1626,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep,
if ((nvl == NULL) || (name == NULL))
return (EINVAL);

sepp = NULL;
idx = 0;
/* step through components of name */
for (np = name; np && *np; np = sepp) {
/* ensure unique names */
Expand Down Expand Up @@ -2383,7 +2385,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
*/
nv_priv_init(&nvpriv, nva, 0);

if (err = nvlist_size(nvl, &alloc_size, encoding))
if ((err = nvlist_size(nvl, &alloc_size, encoding)))
return (err);

if ((buf = nv_mem_zalloc(&nvpriv, alloc_size)) == NULL)
Expand Down
10 changes: 6 additions & 4 deletions usr/src/lib/libnvpair/libnvpair.c
Expand Up @@ -24,7 +24,7 @@
*/

#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <libintl.h>
#include <sys/types.h>
#include <sys/inttypes.h>
Expand Down Expand Up @@ -211,7 +211,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, "%d")
NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x")
NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld")
NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx")
NVLIST_PRTFUNC(double, double, double, "0x%llf")
NVLIST_PRTFUNC(double, double, double, "0x%f")
NVLIST_PRTFUNC(string, char *, char *, "%s")
NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx")

Expand Down Expand Up @@ -1229,7 +1229,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
boolean_t val, val_arg;
int32_t val_arg;
boolean_t val;

/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
Expand All @@ -1240,7 +1241,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
boolean_t *val_array, val_arg;
boolean_t *val_array;
int32_t val_arg;

/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
Expand Down

0 comments on commit 759e89b

Please sign in to comment.