]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix cppcheck warning: unassignedVariable
authorMark Andrews <marka@isc.org>
Tue, 1 Oct 2019 09:08:28 +0000 (19:08 +1000)
committerMark Andrews <marka@isc.org>
Tue, 1 Oct 2019 23:25:00 +0000 (09:25 +1000)
lib/lwres/lwinetpton.c

index 6a1aba7eec4b2ffbf4420f5e185584a8bd1899dd..ed4a6d934ff2617d58bc56786c7304c91e80a6a5 100644 (file)
 /*! \file lwinetpton.c
  */
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
 #include <config.h>
 
 #include <errno.h>
@@ -75,11 +71,11 @@ static int
 inet_pton4(const char *src, unsigned char *dst) {
        static const char digits[] = "0123456789";
        int saw_digit, octets, ch;
-       unsigned char tmp[NS_INADDRSZ], *tp;
+       unsigned char tmp[NS_INADDRSZ] = { 0 }, *tp;
 
        saw_digit = 0;
        octets = 0;
-       *(tp = tmp) = 0;
+       tp = tmp;
        while ((ch = *src++) != '\0') {
                const char *pch;
 
@@ -98,12 +94,7 @@ inet_pton4(const char *src, unsigned char *dst) {
                } else if (ch == '.' && saw_digit) {
                        if (octets == 4)
                                return (0);
-                       /*
-                        * "clang --analyse" generates warnings using:
-                        *              *++tp = 0;
-                        */
                        tp++;
-                       *tp = 0;
                        saw_digit = 0;
                } else
                        return (0);