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
This commit is contained in:
Mariusz Zaborski 2017-09-21 10:00:16 +00:00
parent 53999485e0
commit 08016b3185
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323851
3 changed files with 5 additions and 11 deletions

View File

@ -299,7 +299,6 @@ fd_package_recv(int sock, int *fds, size_t nfds)
PJDLOG_ASSERT(nfds > 0); PJDLOG_ASSERT(nfds > 0);
PJDLOG_ASSERT(fds != NULL); PJDLOG_ASSERT(fds != NULL);
i = 0;
bzero(&msg, sizeof(msg)); bzero(&msg, sizeof(msg));
bzero(&iov, sizeof(iov)); bzero(&iov, sizeof(iov));

View File

@ -280,8 +280,7 @@ nvlist_get_pararr(const nvlist_t *nvl, void **cookiep)
return (ret); return (ret);
} }
ret = nvlist_get_parent(nvl, cookiep); return (nvlist_get_parent(nvl, cookiep));
return (ret);
} }
bool bool
@ -709,7 +708,6 @@ static int *
nvlist_xdescriptors(const nvlist_t *nvl, int *descs) nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
{ {
nvpair_t *nvp; nvpair_t *nvp;
const char *name;
int type; int type;
NVLIST_ASSERT(nvl); NVLIST_ASSERT(nvl);
@ -717,7 +715,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
nvp = NULL; nvp = NULL;
do { do {
while ((name = nvlist_next(nvl, &type, (void**)&nvp)) != NULL) { while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) {
switch (type) { switch (type) {
case NV_TYPE_DESCRIPTOR: case NV_TYPE_DESCRIPTOR:
*descs = nvpair_get_descriptor(nvp); *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); return (descs);
} }
@ -787,7 +785,6 @@ nvlist_ndescriptors(const nvlist_t *nvl)
{ {
#ifndef _KERNEL #ifndef _KERNEL
nvpair_t *nvp; nvpair_t *nvp;
const char *name;
size_t ndescs; size_t ndescs;
int type; int type;
@ -797,7 +794,7 @@ nvlist_ndescriptors(const nvlist_t *nvl)
ndescs = 0; ndescs = 0;
nvp = NULL; nvp = NULL;
do { do {
while ((name = nvlist_next(nvl, &type, (void**)&nvp)) != NULL) { while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) {
switch (type) { switch (type) {
case NV_TYPE_DESCRIPTOR: case NV_TYPE_DESCRIPTOR:
ndescs++; 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); return (ndescs);
#else #else
@ -1258,7 +1255,6 @@ nvlist_send(int sock, const nvlist_t *nvl)
return (-1); return (-1);
ret = -1; ret = -1;
data = NULL;
fdidx = 0; fdidx = 0;
data = nvlist_xpack(nvl, &fdidx, &datasize); data = nvlist_xpack(nvl, &fdidx, &datasize);

View File

@ -1412,7 +1412,6 @@ nvpair_create_nvlist_array(const char *name, const nvlist_t * const *value,
nvp = NULL; nvp = NULL;
nvls = NULL; nvls = NULL;
ii = 0;
if (value == NULL || nitems == 0) { if (value == NULL || nitems == 0) {
ERRNO_SET(EINVAL); ERRNO_SET(EINVAL);