svn commit: r305211 - in head: cddl/contrib/opensolaris/lib/libnvpair sys/cddl/contrib/opensolaris/common/nvpair

Alexander Motin mav at FreeBSD.org
Thu Sep 1 15:17:40 UTC 2016


Author: mav
Date: Thu Sep  1 15:17:39 2016
New Revision: 305211
URL: https://svnweb.freebsd.org/changeset/base/305211

Log:
  MFV r302662: 6447 handful of nvpair cleanups
  
  illumos/illumos-gate at 759e89be359f2af635e4122d147df56bce948773
  https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bc
  e948773
  
  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 at josefsipek.net>
  Reviewed by: Andy Stormont <astormont at racktopsystems.com>
  Reviewed by: Garrett D'Amore <garrett at damore.org>
  Approved by: Robert Mustacchi <rm at joyent.com>
  Author: Steve Dougherty <sdougherty at barracuda.com>

Modified:
  head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
  head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c	Thu Sep  1 15:10:40 2016	(r305210)
+++ head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c	Thu Sep  1 15:17:39 2016	(r305211)
@@ -26,7 +26,7 @@
 #include <solaris.h>
 #include <inttypes.h>
 #include <unistd.h>
-#include <strings.h>
+#include <string.h>
 #include <libintl.h>
 #include <stdarg.h>
 #include "libnvpair.h"
@@ -1228,7 +1228,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);
@@ -1239,7 +1240,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);

Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c	Thu Sep  1 15:10:40 2016	(r305210)
+++ head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c	Thu Sep  1 15:17:39 2016	(r305211)
@@ -1629,6 +1629,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv
 	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 */
@@ -2386,7 +2388,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp,
 	 */
 	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)


More information about the svn-src-head mailing list