mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
improve the conditional declaration and use of variable to silence cppcheck
This commit is contained in:
parent
b71a1386ed
commit
a04bb76973
@ -11,11 +11,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
static char rcsid[] =
|
|
||||||
"$Id: netscope.c,v 1.13 2007/06/19 23:47:17 tbox Exp $";
|
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
@ -28,8 +23,8 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
|
|||||||
char *ep;
|
char *ep;
|
||||||
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
|
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
|
||||||
unsigned int ifid;
|
unsigned int ifid;
|
||||||
#endif
|
|
||||||
struct in6_addr *in6;
|
struct in6_addr *in6;
|
||||||
|
#endif
|
||||||
isc_uint32_t zone;
|
isc_uint32_t zone;
|
||||||
isc_uint64_t llz;
|
isc_uint64_t llz;
|
||||||
|
|
||||||
@ -37,8 +32,6 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
|
|||||||
if (af != AF_INET6)
|
if (af != AF_INET6)
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
|
|
||||||
in6 = (struct in6_addr *)addr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basically, "names" are more stable than numeric IDs in terms of
|
* Basically, "names" are more stable than numeric IDs in terms of
|
||||||
* renumbering, and are more preferred. However, since there is no
|
* renumbering, and are more preferred. However, since there is no
|
||||||
@ -48,6 +41,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
|
|||||||
* interfaces and links.
|
* interfaces and links.
|
||||||
*/
|
*/
|
||||||
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
|
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
|
||||||
|
in6 = (struct in6_addr *)addr;
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(in6) &&
|
if (IN6_IS_ADDR_LINKLOCAL(in6) &&
|
||||||
(ifid = if_nametoindex((const char *)scopename)) != 0)
|
(ifid = if_nametoindex((const char *)scopename)) != 0)
|
||||||
zone = (isc_uint32_t)ifid;
|
zone = (isc_uint32_t)ifid;
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
* information regarding copyright ownership.
|
* information regarding copyright ownership.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: entropy.c,v 1.82 2008/12/01 23:47:45 tbox Exp $ */
|
|
||||||
|
|
||||||
/* \file unix/entropy.c
|
/* \file unix/entropy.c
|
||||||
* \brief
|
* \brief
|
||||||
* This is the system dependent part of the ISC entropy API.
|
* This is the system dependent part of the ISC entropy API.
|
||||||
@ -452,11 +450,14 @@ destroyusocketsource(isc_entropyusocketsource_t *source) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
make_nonblock(int fd) {
|
make_nonblock(int fd) {
|
||||||
int ret;
|
int ret;
|
||||||
int flags;
|
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
#ifdef USE_FIONBIO_IOCTL
|
#ifdef USE_FIONBIO_IOCTL
|
||||||
int on = 1;
|
int on = 1;
|
||||||
|
#else
|
||||||
|
int flags;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FIONBIO_IOCTL
|
||||||
ret = ioctl(fd, FIONBIO, (char *)&on);
|
ret = ioctl(fd, FIONBIO, (char *)&on);
|
||||||
#else
|
#else
|
||||||
flags = fcntl(fd, F_GETFL, 0);
|
flags = fcntl(fd, F_GETFL, 0);
|
||||||
|
@ -1225,11 +1225,14 @@ select_poke(isc__socketmgr_t *manager, int fd, int msg) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
make_nonblock(int fd) {
|
make_nonblock(int fd) {
|
||||||
int ret;
|
int ret;
|
||||||
int flags;
|
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
#ifdef USE_FIONBIO_IOCTL
|
#ifdef USE_FIONBIO_IOCTL
|
||||||
int on = 1;
|
int on = 1;
|
||||||
|
#else
|
||||||
|
int flags;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FIONBIO_IOCTL
|
||||||
ret = ioctl(fd, FIONBIO, (char *)&on);
|
ret = ioctl(fd, FIONBIO, (char *)&on);
|
||||||
#else
|
#else
|
||||||
flags = fcntl(fd, F_GETFL, 0);
|
flags = fcntl(fd, F_GETFL, 0);
|
||||||
@ -1311,6 +1314,7 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) {
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
|
process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
|
||||||
|
#ifdef ISC_NET_BSD44MSGHDR
|
||||||
#ifdef USE_CMSG
|
#ifdef USE_CMSG
|
||||||
struct cmsghdr *cmsgp;
|
struct cmsghdr *cmsgp;
|
||||||
#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
|
#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
|
||||||
@ -1319,6 +1323,7 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
|
|||||||
#ifdef SO_TIMESTAMP
|
#ifdef SO_TIMESTAMP
|
||||||
void *timevalp;
|
void *timevalp;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1570,6 +1575,7 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev,
|
|||||||
INSIST((int)sock->dscp == isc_dscp_check_value);
|
INSIST((int)sock->dscp == isc_dscp_check_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(IP_TOS) || (defined(IPPROTO_IPV6) && defined(IPV6_TCLASS))
|
||||||
if ((sock->type == isc_sockettype_udp) &&
|
if ((sock->type == isc_sockettype_udp) &&
|
||||||
((dev->attributes & ISC_SOCKEVENTATTR_DSCP) != 0))
|
((dev->attributes & ISC_SOCKEVENTATTR_DSCP) != 0))
|
||||||
{
|
{
|
||||||
@ -1645,6 +1651,7 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev,
|
|||||||
sock->sendcmsgbuflen - msg->msg_controllen);
|
sock->sendcmsgbuflen - msg->msg_controllen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif /* USE_CMSG */
|
#endif /* USE_CMSG */
|
||||||
#else /* ISC_NET_BSD44MSGHDR */
|
#else /* ISC_NET_BSD44MSGHDR */
|
||||||
msg->msg_accrights = NULL;
|
msg->msg_accrights = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user