Date: Tue, 12 Jul 2016 12:05:59 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r302662 - vendor-sys/illumos/dist/common/nvpair vendor/illumos/dist/lib/libnvpair Message-ID: <201607121205.u6CC5xwW008395@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Tue Jul 12 12:05:58 2016 New Revision: 302662 URL: https://svnweb.freebsd.org/changeset/base/302662 Log: 6447 handful of nvpair cleanups illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773 https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bce948773 https://www.illumos.org/issues/6447 I got a patch from someone who uses nvpair code outside of illumos. It fixes a couple of gcc warnings/bugs for him. 1. silence uninitialized use warnings 2. add parentheses around assignment used as truth value 3. fix printf format specifier (ll is for integers only) 4. strstr, strspn, strcspn, and strcmp are declared in string.h, not strings.h. 5. avoid scanning integer into boolean variable 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> Author: Steve Dougherty <sdougherty@barracuda.com> Modified: vendor/illumos/dist/lib/libnvpair/libnvpair.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/common/nvpair/nvpair.c Modified: vendor/illumos/dist/lib/libnvpair/libnvpair.c ============================================================================== --- vendor/illumos/dist/lib/libnvpair/libnvpair.c Tue Jul 12 12:03:00 2016 (r302661) +++ vendor/illumos/dist/lib/libnvpair/libnvpair.c Tue Jul 12 12:05:58 2016 (r302662) @@ -24,7 +24,7 @@ */ #include <unistd.h> -#include <strings.h> +#include <string.h> #include <libintl.h> #include <sys/types.h> #include <sys/inttypes.h> @@ -211,7 +211,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, 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") @@ -1218,7 +1218,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 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); @@ -1229,7 +1230,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607121205.u6CC5xwW008395>