diff options
| author | 2020-01-24 22:46:36 +0000 | |
|---|---|---|
| committer | 2020-01-24 22:46:36 +0000 | |
| commit | f96bb33f4775ce2a1279cb96ebaecb010eb3bdc3 (patch) | |
| tree | 9b2ab0af0e72e725c026e33cb8dd0226e3808486 /usr.sbin/tcpdump/print-llc.c | |
| parent | Add FILES sections; OK espie@ solene@. (diff) | |
| download | wireguard-openbsd-f96bb33f4775ce2a1279cb96ebaecb010eb3bdc3.tar.xz wireguard-openbsd-f96bb33f4775ce2a1279cb96ebaecb010eb3bdc3.zip | |
- (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-llc.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-llc.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/usr.sbin/tcpdump/print-llc.c b/usr.sbin/tcpdump/print-llc.c index a18e859930e..14829688033 100644 --- a/usr.sbin/tcpdump/print-llc.c +++ b/usr.sbin/tcpdump/print-llc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-llc.c,v 1.21 2019/04/05 00:57:59 dlg Exp $ */ +/* $OpenBSD: print-llc.c,v 1.22 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 @@ -68,7 +68,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, int ret; if (caplen < 3) { - (void)printf("[|llc]"); + printf("[|llc]"); default_print((u_char *)p, caplen); return(0); } @@ -93,7 +93,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, if (llc.ssap == LLCSAP_SNAP && llc.dsap == LLCSAP_SNAP && llc.llcui == LLC_UI) { if (caplen < sizeof(llc)) { - (void)printf("[|llc-snap]"); + printf("[|llc-snap]"); default_print((u_char *)p, caplen); return (0); } @@ -110,7 +110,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, } if (vflag) - (void)printf("snap %s ", protoid_string(llc.llcpi)); + printf("snap %s ", protoid_string(llc.llcpi)); caplen -= sizeof(llc); length -= sizeof(llc); @@ -185,23 +185,23 @@ llc_print(const u_char *p, u_int length, u_int caplen, if ((llc.ssap & ~LLC_GSAP) == llc.dsap) { if (eflag) - (void)printf("%s ", llcsap_string(llc.dsap)); + printf("%s ", llcsap_string(llc.dsap)); else - (void)printf("%s > %s %s ", - etheraddr_string(esrc), - etheraddr_string(edst), - llcsap_string(llc.dsap)); + printf("%s > %s %s ", + etheraddr_string(esrc), + etheraddr_string(edst), + llcsap_string(llc.dsap)); } else { if (eflag) - (void)printf("%s > %s ", - llcsap_string(llc.ssap & ~LLC_GSAP), - llcsap_string(llc.dsap)); + printf("%s > %s ", + llcsap_string(llc.ssap & ~LLC_GSAP), + llcsap_string(llc.dsap)); else - (void)printf("%s %s > %s %s ", - etheraddr_string(esrc), - llcsap_string(llc.ssap & ~LLC_GSAP), - etheraddr_string(edst), - llcsap_string(llc.dsap)); + printf("%s %s > %s %s ", + etheraddr_string(esrc), + llcsap_string(llc.ssap & ~LLC_GSAP), + etheraddr_string(edst), + llcsap_string(llc.dsap)); } if ((llc.llcu & LLC_U_FMT) == LLC_U_FMT) { @@ -262,20 +262,20 @@ llc_print(const u_char *p, u_int length, u_int caplen, if ((llc.llcu & LLC_S_FMT) == LLC_S_FMT) { static char *llc_s[] = { "rr", "rej", "rnr", "03" }; - (void)printf("%s (r=%d,%c)", - llc_s[LLC_S_CMD(llc.llcis)], - LLC_IS_NR(llc.llcis), - f); + printf("%s (r=%d,%c)", + llc_s[LLC_S_CMD(llc.llcis)], + LLC_IS_NR(llc.llcis), + f); } else { - (void)printf("I (s=%d,r=%d,%c)", - LLC_I_NS(llc.llcis), - LLC_IS_NR(llc.llcis), - f); + printf("I (s=%d,r=%d,%c)", + LLC_I_NS(llc.llcis), + LLC_IS_NR(llc.llcis), + f); } p += 4; length -= 4; caplen -= 4; } - (void)printf(" len=%d", length); + printf(" len=%d", length); return(1); } |
