From: Francois-Xavier Le Bail Date: Fri, 1 Jun 2018 20:06:42 +0000 (+0200) Subject: Simplify some expressions X-Git-Tag: tcpdump-4.99-bp~1147 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/5fe61e70f1afddf691b6a944dcd1e369194259ec Simplify some expressions In the equality case, the difference is also zero. --- diff --git a/print-ascii.c b/print-ascii.c index 83b0c38f..8c12b4fd 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -65,7 +65,7 @@ ascii_print(netdissect_options *ndo, u_char s; ndo->ndo_protocol = "ascii"; - caplength = (ndo->ndo_snapend >= cp) ? ndo->ndo_snapend - cp : 0; + caplength = (ndo->ndo_snapend > cp) ? ndo->ndo_snapend - cp : 0; if (length > caplength) length = caplength; ND_PRINT("\n"); @@ -106,7 +106,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident, char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp; char asciistuff[ASCII_LINELENGTH+1], *asp; - caplength = (ndo->ndo_snapend >= cp) ? ndo->ndo_snapend - cp : 0; + caplength = (ndo->ndo_snapend > cp) ? ndo->ndo_snapend - cp : 0; if (length > caplength) length = caplength; nshorts = length / sizeof(u_short); @@ -168,7 +168,7 @@ hex_print_with_offset(netdissect_options *ndo, u_int i, s; int nshorts; - caplength = (ndo->ndo_snapend >= cp) ? ndo->ndo_snapend - cp : 0; + caplength = (ndo->ndo_snapend > cp) ? ndo->ndo_snapend - cp : 0; if (length > caplength) length = caplength; nshorts = (u_int) length / sizeof(u_short);