Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Sep 2017 10:00:16 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323851 - in head: lib/libnv sys/contrib/libnv
Message-ID:  <201709211000.v8LA0G51064496@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Thu Sep 21 10:00:16 2017
New Revision: 323851
URL: https://svnweb.freebsd.org/changeset/base/323851

Log:
  Remove redundant initialization. Don't use variable - just return the value.
  Make scan-build happy by casting to 'void *' instead of 'void **'.
  
  Submitted by:	pjd@
  MFC after:	1 month
  Found by:	scan-build and cppcheck
  Sponsored by:	Wheel Systems

Modified:
  head/lib/libnv/msgio.c
  head/sys/contrib/libnv/nvlist.c
  head/sys/contrib/libnv/nvpair.c

Modified: head/lib/libnv/msgio.c
==============================================================================
--- head/lib/libnv/msgio.c	Thu Sep 21 09:47:56 2017	(r323850)
+++ head/lib/libnv/msgio.c	Thu Sep 21 10:00:16 2017	(r323851)
@@ -299,7 +299,6 @@ fd_package_recv(int sock, int *fds, size_t nfds)
 	PJDLOG_ASSERT(nfds > 0);
 	PJDLOG_ASSERT(fds != NULL);
 
-	i = 0;
 	bzero(&msg, sizeof(msg));
 	bzero(&iov, sizeof(iov));
 

Modified: head/sys/contrib/libnv/nvlist.c
==============================================================================
--- head/sys/contrib/libnv/nvlist.c	Thu Sep 21 09:47:56 2017	(r323850)
+++ head/sys/contrib/libnv/nvlist.c	Thu Sep 21 10:00:16 2017	(r323851)
@@ -280,8 +280,7 @@ nvlist_get_pararr(const nvlist_t *nvl, void **cookiep)
 		return (ret);
 	}
 
-	ret = nvlist_get_parent(nvl, cookiep);
-	return (ret);
+	return (nvlist_get_parent(nvl, cookiep));
 }
 
 bool
@@ -709,7 +708,6 @@ static int *
 nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
 {
 	nvpair_t *nvp;
-	const char *name;
 	int type;
 
 	NVLIST_ASSERT(nvl);
@@ -717,7 +715,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
 
 	nvp = NULL;
 	do {
-		while ((name = nvlist_next(nvl, &type, (void**)&nvp)) != NULL) {
+		while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) {
 			switch (type) {
 			case NV_TYPE_DESCRIPTOR:
 				*descs = nvpair_get_descriptor(nvp);
@@ -756,7 +754,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
 			    }
 			}
 		}
-	} while ((nvl = nvlist_get_pararr(nvl, (void**)&nvp)) != NULL);
+	} while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL);
 
 	return (descs);
 }
@@ -787,7 +785,6 @@ nvlist_ndescriptors(const nvlist_t *nvl)
 {
 #ifndef _KERNEL
 	nvpair_t *nvp;
-	const char *name;
 	size_t ndescs;
 	int type;
 
@@ -797,7 +794,7 @@ nvlist_ndescriptors(const nvlist_t *nvl)
 	ndescs = 0;
 	nvp = NULL;
 	do {
-		while ((name = nvlist_next(nvl, &type, (void**)&nvp)) != NULL) {
+		while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) {
 			switch (type) {
 			case NV_TYPE_DESCRIPTOR:
 				ndescs++;
@@ -830,7 +827,7 @@ nvlist_ndescriptors(const nvlist_t *nvl)
 			    }
 			}
 		}
-	} while ((nvl = nvlist_get_pararr(nvl, (void**)&nvp)) != NULL);
+	} while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL);
 
 	return (ndescs);
 #else
@@ -1258,7 +1255,6 @@ nvlist_send(int sock, const nvlist_t *nvl)
 		return (-1);
 
 	ret = -1;
-	data = NULL;
 	fdidx = 0;
 
 	data = nvlist_xpack(nvl, &fdidx, &datasize);

Modified: head/sys/contrib/libnv/nvpair.c
==============================================================================
--- head/sys/contrib/libnv/nvpair.c	Thu Sep 21 09:47:56 2017	(r323850)
+++ head/sys/contrib/libnv/nvpair.c	Thu Sep 21 10:00:16 2017	(r323851)
@@ -1412,7 +1412,6 @@ nvpair_create_nvlist_array(const char *name, const nvl
 
 	nvp = NULL;
 	nvls = NULL;
-	ii = 0;
 
 	if (value == NULL || nitems == 0) {
 		ERRNO_SET(EINVAL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709211000.v8LA0G51064496>