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-mobile.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-mobile.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-mobile.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/print-mobile.c b/usr.sbin/tcpdump/print-mobile.c index 867b737f324..d7056f1df93 100644 --- a/usr.sbin/tcpdump/print-mobile.c +++ b/usr.sbin/tcpdump/print-mobile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-mobile.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: print-mobile.c,v 1.6 2020/01/24 22:46:37 procter Exp $ */ /* $NetBSD: print-mobile.c,v 1.3 1999/07/26 06:11:57 itojun Exp $ */ /* @@ -71,7 +71,7 @@ mobile_print(const u_char *bp, u_int length) mob = (const struct mobile_ip *)bp; if (length < MOBILE_SIZE) { - fputs("[|mobile]", stdout); + printf("[|mobile]"); return; } @@ -83,18 +83,18 @@ mobile_print(const u_char *bp, u_int length) } if (osp) { - fputs("[S] ",stdout); + printf("[S] "); if (vflag) - (void)printf("%s ",ipaddr_string(&mob->osrc)); + printf("%s ",ipaddr_string(&mob->osrc)); } else { - fputs("[] ",stdout); + printf("[] "); } if (vflag) { - (void)printf("> %s ",ipaddr_string(&mob->odst)); - (void)printf("(oproto=%d)",proto>>8); + printf("> %s ",ipaddr_string(&mob->odst)); + printf("(oproto=%d)",proto>>8); } if (mob_in_cksum((u_short *)mob, osp ? 12 : 8)!=0) { - (void)printf(" (bad checksum %d)",crc); + printf(" (bad checksum %d)",crc); } return; |
