diff options
author | Richard Procter <procter@cvs.openbsd.org> | 2020-01-24 22:46:38 +0000 |
---|---|---|
committer | Richard Procter <procter@cvs.openbsd.org> | 2020-01-24 22:46:38 +0000 |
commit | 29981ecc3d0e1a683ba42811ac611ce0c7cf23a2 (patch) | |
tree | 96f3673162bcfd42351dcc9545f7a069644845aa /usr.sbin/tcpdump/print-igrp.c | |
parent | cd1bbbfbe5544d90fb80a0d423234cef5385897f (diff) |
- (void)printf() -> printf(); the cast adds clutter for little value.
- fprintf(stdout, ...) -> printf()
- fputs(x, stdout) -> printf(); for consistency.
fputs is twice as fast on atom x5-Z8300@1.44GHz but Amdahl sees a pure printf
tcpdump only 2% slower than a pure fputs (for constant strings) tcpdump
to /dev/null across a 20MB/~170k packet pcap file.
ok dlg@ for fputs and ok tedu@ krw@ deraadt@ a2k19 for the rest
Diffstat (limited to 'usr.sbin/tcpdump/print-igrp.c')
-rw-r--r-- | usr.sbin/tcpdump/print-igrp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/tcpdump/print-igrp.c b/usr.sbin/tcpdump/print-igrp.c index 1baab1b3f4d..810f4b648c1 100644 --- a/usr.sbin/tcpdump/print-igrp.c +++ b/usr.sbin/tcpdump/print-igrp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-igrp.c,v 1.8 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-igrp.c,v 1.9 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1996, 1997 @@ -86,7 +86,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) hdr = (struct igrphdr *)bp; ip = (struct ip *)bp2; cp = (u_char *)(hdr + 1); - (void)printf("%s > %s: igrp: ", + printf("%s > %s: igrp: ", ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst)); @@ -96,7 +96,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) nsys = EXTRACT_16BITS(&hdr->ig_ns); next = EXTRACT_16BITS(&hdr->ig_nx); - (void)printf(" %s V%d edit=%d AS=%d (%d/%d/%d)", + printf(" %s V%d edit=%d AS=%d (%d/%d/%d)", tok2str(op2str, "op-#%d", hdr->ig_op), hdr->ig_v, hdr->ig_ed, @@ -120,7 +120,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) igrp_entry_print((struct igrprte *)cp, 0, 1); --next; } else { - (void)printf("[extra bytes %d]", length); + printf("[extra bytes %d]", length); break; } cp += IGRP_RTE_SIZE; @@ -129,5 +129,5 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) if (nint == 0 && nsys == 0 && next == 0) return; trunc: - fputs("[|igrp]", stdout); + printf("[|igrp]"); } |