]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
improve the conditional declaration and use of variable to silence cppcheck
authorMark Andrews <marka@isc.org>
Tue, 20 Feb 2018 02:08:08 +0000 (13:08 +1100)
committerMark Andrews <marka@isc.org>
Sun, 25 Feb 2018 23:58:09 +0000 (10:58 +1100)
(cherry picked from commit a04bb76973e5d30d0ec7cc268eaa8db2a91934e6)
(cherry picked from commit 8e046acb50ab41ad6bd57565f8d94887e32dff33)

lib/isc/netscope.c
lib/isc/unix/entropy.c
lib/isc/unix/socket.c

index 9aa11db9a8cef490a4f6e2835f2196e53768271e..dbdf9c9b99cab3ae2e002daa16afa3458045043b 100644 (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 <isc/string.h>
@@ -34,8 +29,8 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
        char *ep;
 #ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
        unsigned int ifid;
-#endif
        struct in6_addr *in6;
+#endif
        isc_uint32_t zone;
        isc_uint64_t llz;
 
@@ -43,8 +38,6 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
        if (af != AF_INET6)
                return (ISC_R_FAILURE);
 
-       in6 = (struct in6_addr *)addr;
-
        /*
         * Basically, "names" are more stable than numeric IDs in terms of
         * renumbering, and are more preferred.  However, since there is no
@@ -54,6 +47,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
         * interfaces and links.
         */
 #ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
+       in6 = (struct in6_addr *)addr;
        if (IN6_IS_ADDR_LINKLOCAL(in6) &&
            (ifid = if_nametoindex((const char *)scopename)) != 0)
                zone = (isc_uint32_t)ifid;
index d2b75d32d7035d8fc42ffe48eb09ef4e77643189..63e5c1a163ea14d3e625bfa7bb1ec814a7bba246 100644 (file)
@@ -15,8 +15,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: entropy.c,v 1.82 2008/12/01 23:47:45 tbox Exp $ */
-
 /* \file unix/entropy.c
  * \brief
  * This is the system dependent part of the ISC entropy API.
@@ -458,11 +456,14 @@ destroyusocketsource(isc_entropyusocketsource_t *source) {
 static isc_result_t
 make_nonblock(int fd) {
        int ret;
-       int flags;
        char strbuf[ISC_STRERRORSIZE];
 #ifdef USE_FIONBIO_IOCTL
        int on = 1;
+#else
+       int flags;
+#endif
 
+#ifdef USE_FIONBIO_IOCTL
        ret = ioctl(fd, FIONBIO, (char *)&on);
 #else
        flags = fcntl(fd, F_GETFL, 0);
index 26704f6bcb677ac7601c2ffe30fcca52b10524f7..49c013670f0b8e07461c48462c3648a9718dcbbd 100644 (file)
@@ -1145,11 +1145,14 @@ select_poke(isc__socketmgr_t *manager, int fd, int msg) {
 static isc_result_t
 make_nonblock(int fd) {
        int ret;
-       int flags;
        char strbuf[ISC_STRERRORSIZE];
 #ifdef USE_FIONBIO_IOCTL
        int on = 1;
+#else
+       int flags;
+#endif
 
+#ifdef USE_FIONBIO_IOCTL
        ret = ioctl(fd, FIONBIO, (char *)&on);
 #else
        flags = fcntl(fd, F_GETFL, 0);
@@ -1231,6 +1234,7 @@ cmsg_space(ISC_SOCKADDR_LEN_T len) {
  */
 static void
 process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
+#ifdef ISC_NET_BSD44MSGHDR
 #ifdef USE_CMSG
        struct cmsghdr *cmsgp;
 #ifdef ISC_PLATFORM_HAVEIN6PKTINFO
@@ -1239,6 +1243,7 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
 #ifdef SO_TIMESTAMP
        void *timevalp;
 #endif
+#endif
 #endif
 
        /*