Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 Remove annoying (void) casts.



details:   https://anonhg.NetBSD.org/src/rev/d0e9e763140e
branches:  trunk
changeset: 318446:d0e9e763140e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Apr 24 07:12:04 2018 +0000
description:
Remove annoying (void) casts.

diffstat:

 sbin/ping6/ping6.c |  166 ++++++++++++++++++++++++++--------------------------
 1 files changed, 83 insertions(+), 83 deletions(-)

diffs (truncated from 465 to 300 lines):

diff -r 0a3462528a64 -r d0e9e763140e sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Tue Apr 24 01:32:30 2018 +0000
+++ b/sbin/ping6/ping6.c        Tue Apr 24 07:12:04 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping6.c,v 1.101 2018/04/23 18:48:30 maxv Exp $ */
+/*     $NetBSD: ping6.c,v 1.102 2018/04/24 07:12:04 maxv Exp $ */
 /*     $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */
 
 /*
@@ -77,7 +77,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.101 2018/04/23 18:48:30 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.102 2018/04/24 07:12:04 maxv Exp $");
 #endif
 #endif
 
@@ -587,7 +587,7 @@
        if (!res->ai_addr)
                errx(1, "getaddrinfo failed");
 
-       (void)memcpy(&dst, res->ai_addr, res->ai_addrlen);
+       memcpy(&dst, res->ai_addr, res->ai_addrlen);
 
        if ((s = prog_socket(res->ai_family, res->ai_socktype,
            res->ai_protocol)) < 0)
@@ -1169,7 +1169,7 @@
        if (i < 0 || i != cc)  {
                if (i < 0)
                        warn("sendmsg");
-               (void)printf("ping6: wrote %s %d chars, ret=%d\n",
+               printf("ping6: wrote %s %d chars, ret=%d\n",
                    hostname, cc, i);
        }
        if (!(options & F_QUIET) && options & F_FLOOD)
@@ -1370,9 +1370,9 @@
                if (options & F_FLOOD)
                        (void)write(STDOUT_FILENO, &BSPACE, 1);
                else {
-                       (void)printf("%d bytes from %s, icmp_seq=%u", cc,
+                       printf("%d bytes from %s, icmp_seq=%u", cc,
                            pr_addr(from, fromlen), seq);
-                       (void)printf(" hlim=%d", hoplim);
+                       printf(" hlim=%d", hoplim);
                        if ((options & F_VERBOSE) != 0) {
                                struct sockaddr_in6 dstsa;
 
@@ -1383,20 +1383,20 @@
 #endif
                                dstsa.sin6_scope_id = pktinfo->ipi6_ifindex;
                                dstsa.sin6_addr = pktinfo->ipi6_addr;
-                               (void)printf(" dst=%s",
+                               printf(" dst=%s",
                                    pr_addr((struct sockaddr *)&dstsa,
                                    sizeof(dstsa)));
                        }
                        if (timing)
-                               (void)printf(" time=%.3f ms", triptime);
+                               printf(" time=%.3f ms", triptime);
                        if (dupflag)
-                               (void)printf("(DUP!)");
+                               printf("(DUP!)");
                        /* check the data */
                        cp = buf + off + ICMP6ECHOLEN + ICMP6ECHOTMLEN;
                        dp = outpack + ICMP6ECHOLEN + ICMP6ECHOTMLEN;
                        for (i = 8; cp < end; ++i, ++cp, ++dp) {
                                if (*cp != *dp) {
-                                       (void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x", i, *dp, *cp);
+                                       printf("\nwrong data byte #%d should be 0x%x but was 0x%x", i, *dp, *cp);
                                        break;
                                }
                        }
@@ -1417,7 +1417,7 @@
                if (options & F_QUIET)
                        return;
 
-               (void)printf("%d bytes from %s: ", cc, pr_addr(from, fromlen));
+               printf("%d bytes from %s: ", cc, pr_addr(from, fromlen));
 
                switch (ntohs(ni->ni_code)) {
                case ICMP6_NI_SUCCESS:
@@ -1484,15 +1484,15 @@
                                int32_t ttl;
                                int comma = 0;
 
-                               (void)printf(" (");     /*)*/
+                               printf(" (");   /*)*/
 
                                switch (ni->ni_code) {
                                case ICMP6_NI_REFUSED:
-                                       (void)printf("refused");
+                                       printf("refused");
                                        comma++;
                                        break;
                                case ICMP6_NI_UNKNOWN:
-                                       (void)printf("unknown qtype");
+                                       printf("unknown qtype");
                                        comma++;
                                        break;
                                }
@@ -1507,14 +1507,14 @@
                                if (comma)
                                        printf(",");
                                if (!(ni->ni_flags & NI_FQDN_FLAG_VALIDTTL)) {
-                                       (void)printf("TTL=%d:meaningless",
+                                       printf("TTL=%d:meaningless",
                                            (int)ttl);
                                } else {
                                        if (ttl < 0) {
-                                               (void)printf("TTL=%d:invalid",
+                                               printf("TTL=%d:invalid",
                                                   ttl);
                                        } else
-                                               (void)printf("TTL=%d", ttl);
+                                               printf("TTL=%d", ttl);
                                }
                                comma++;
 
@@ -1537,7 +1537,7 @@
                                    cc - off - ICMP6_NIRLEN - 1 && oldfqdn) {
                                        if (comma)
                                                printf(",");
-                                       (void)printf("invalid namelen:%d/%lu",
+                                       printf("invalid namelen:%d/%lu",
                                            buf[off + ICMP6_NIRLEN],
                                            (u_long)cc - off - ICMP6_NIRLEN - 1);
                                        comma++;
@@ -1552,7 +1552,7 @@
                /* We've got something other than an ECHOREPLY */
                if (!(options & F_VERBOSE))
                        return;
-               (void)printf("%d bytes from %s: ", cc, pr_addr(from, fromlen));
+               printf("%d bytes from %s: ", cc, pr_addr(from, fromlen));
                pr_icmph(icp, end);
        }
 
@@ -1804,14 +1804,14 @@
        if (options & F_VERBOSE) {
                switch (ni->ni_code) {
                case ICMP6_NI_REFUSED:
-                       (void)printf("refused");
+                       printf("refused");
                        break;
                case ICMP6_NI_UNKNOWN:
-                       (void)printf("unknown qtype");
+                       printf("unknown qtype");
                        break;
                }
                if (ni->ni_flags & NI_NODEADDR_FLAG_TRUNCATE)
-                       (void)printf(" truncated");
+                       printf(" truncated");
        }
        putchar('\n');
        if (nilen <= 0)
@@ -1989,16 +1989,16 @@
 summary(void)
 {
 
-       (void)printf("\n--- %s ping6 statistics ---\n", hostname);
-       (void)printf("%ld packets transmitted, ", ntransmitted);
-       (void)printf("%ld packets received, ", nreceived);
+       printf("\n--- %s ping6 statistics ---\n", hostname);
+       printf("%ld packets transmitted, ", ntransmitted);
+       printf("%ld packets received, ", nreceived);
        if (nrepeats)
-               (void)printf("+%ld duplicates, ", nrepeats);
+               printf("+%ld duplicates, ", nrepeats);
        if (ntransmitted) {
                if (nreceived > ntransmitted)
-                       (void)printf("-- somebody's duplicating packets!");
+                       printf("-- somebody's duplicating packets!");
                else
-                       (void)printf("%.1f%% packet loss",
+                       printf("%.1f%% packet loss",
                            ((((double)ntransmitted - nreceived) * 100.0) /
                            ntransmitted));
        }
@@ -2014,7 +2014,7 @@
                        avg = tsum;
                        dev = 0.0;
                }
-               (void)printf(
+               printf(
                    "round-trip min/avg/max/std-dev = %.3f/%.3f/%.3f/%.3f ms\n",
                    tmin, avg, tmax, dev);
                (void)fflush(stdout);
@@ -2053,23 +2053,23 @@
        case ICMP6_DST_UNREACH:
                switch (icp->icmp6_code) {
                case ICMP6_DST_UNREACH_NOROUTE:
-                       (void)printf("No Route to Destination\n");
+                       printf("No Route to Destination\n");
                        break;
                case ICMP6_DST_UNREACH_ADMIN:
-                       (void)printf("Destination Administratively "
+                       printf("Destination Administratively "
                            "Unreachable\n");
                        break;
                case ICMP6_DST_UNREACH_BEYONDSCOPE:
-                       (void)printf("Destination Unreachable Beyond Scope\n");
+                       printf("Destination Unreachable Beyond Scope\n");
                        break;
                case ICMP6_DST_UNREACH_ADDR:
-                       (void)printf("Destination Host Unreachable\n");
+                       printf("Destination Host Unreachable\n");
                        break;
                case ICMP6_DST_UNREACH_NOPORT:
-                       (void)printf("Destination Port Unreachable\n");
+                       printf("Destination Port Unreachable\n");
                        break;
                default:
-                       (void)printf("Destination Unreachable, Bad Code: %d\n",
+                       printf("Destination Unreachable, Bad Code: %d\n",
                            icp->icmp6_code);
                        break;
                }
@@ -2077,110 +2077,110 @@
                pr_retip((struct ip6_hdr *)(icp + 1), end);
                break;
        case ICMP6_PACKET_TOO_BIG:
-               (void)printf("Packet too big mtu = %d\n",
+               printf("Packet too big mtu = %d\n",
                    (int)ntohl(icp->icmp6_mtu));
                pr_retip((struct ip6_hdr *)(icp + 1), end);
                break;
        case ICMP6_TIME_EXCEEDED:
                switch (icp->icmp6_code) {
                case ICMP6_TIME_EXCEED_TRANSIT:
-                       (void)printf("Time to live exceeded\n");
+                       printf("Time to live exceeded\n");
                        break;
                case ICMP6_TIME_EXCEED_REASSEMBLY:
-                       (void)printf("Frag reassembly time exceeded\n");
+                       printf("Frag reassembly time exceeded\n");
                        break;
                default:
-                       (void)printf("Time exceeded, Bad Code: %d\n",
+                       printf("Time exceeded, Bad Code: %d\n",
                            icp->icmp6_code);
                        break;
                }
                pr_retip((struct ip6_hdr *)(icp + 1), end);
                break;
        case ICMP6_PARAM_PROB:
-               (void)printf("Parameter problem: ");
+               printf("Parameter problem: ");
                switch (icp->icmp6_code) {
                case ICMP6_PARAMPROB_HEADER:
-                       (void)printf("Erroneous Header ");
+                       printf("Erroneous Header ");
                        break;
                case ICMP6_PARAMPROB_NEXTHEADER:
-                       (void)printf("Unknown Nextheader ");
+                       printf("Unknown Nextheader ");
                        break;
                case ICMP6_PARAMPROB_OPTION:
-                       (void)printf("Unrecognized Option ");
+                       printf("Unrecognized Option ");
                        break;
                default:
-                       (void)printf("Bad code(%d) ", icp->icmp6_code);
+                       printf("Bad code(%d) ", icp->icmp6_code);
                        break;
                }
-               (void)printf("pointer = 0x%02x\n",
+               printf("pointer = 0x%02x\n",
                    (u_int32_t)ntohl(icp->icmp6_pptr));
                pr_retip((struct ip6_hdr *)(icp + 1), end);
                break;
        case ICMP6_ECHO_REQUEST:
-               (void)printf("Echo Request");
+               printf("Echo Request");
                /* XXX ID + Seq + Data */
                break;
        case ICMP6_ECHO_REPLY:
-               (void)printf("Echo Reply");
+               printf("Echo Reply");
                /* XXX ID + Seq + Data */
                break;
        case ICMP6_MEMBERSHIP_QUERY:
-               (void)printf("Listener Query");
+               printf("Listener Query");
                break;
        case ICMP6_MEMBERSHIP_REPORT:
-               (void)printf("Listener Report");
+               printf("Listener Report");
                break;
        case ICMP6_MEMBERSHIP_REDUCTION:
-               (void)printf("Listener Done");
+               printf("Listener Done");
                break;
        case ND_ROUTER_SOLICIT:
-               (void)printf("Router Solicitation");
+               printf("Router Solicitation");
                break;
        case ND_ROUTER_ADVERT:
-               (void)printf("Router Advertisement");
+               printf("Router Advertisement");
                break;



Home | Main Index | Thread Index | Old Index