From 1a04b92e365f5ed01ca38619b41bcc4fc9cbd63c Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Fri, 15 Dec 2017 19:39:00 +0100 Subject: [PATCH] Use more the ND_TTEST_1() macro --- print-fr.c | 12 ++++++------ print-ip.c | 2 +- print-isoclns.c | 2 +- print-pim.c | 2 +- print-ppp.c | 2 +- util-print.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/print-fr.c b/print-fr.c index 0d34c039..f1ff0af7 100644 --- a/print-fr.c +++ b/print-fr.c @@ -802,7 +802,7 @@ q933_print(netdissect_options *ndo, ND_PRINT((ndo, "%s", ndo->ndo_eflag ? "" : "Q.933")); - if (length == 0 || !ND_TTEST(*p)) { + if (length == 0 || !ND_TTEST_1(p)) { if (!ndo->ndo_eflag) ND_PRINT((ndo, ", ")); ND_PRINT((ndo, "length %u", length)); @@ -821,7 +821,7 @@ q933_print(netdissect_options *ndo, * Get the call reference value. */ for (i = 0; i < call_ref_length; i++) { - if (length == 0 || !ND_TTEST(*p)) { + if (length == 0 || !ND_TTEST_1(p)) { if (!ndo->ndo_eflag) ND_PRINT((ndo, ", ")); ND_PRINT((ndo, "length %u", olen)); @@ -835,7 +835,7 @@ q933_print(netdissect_options *ndo, /* * Get the message type. */ - if (length == 0 || !ND_TTEST(*p)) { + if (length == 0 || !ND_TTEST_1(p)) { if (!ndo->ndo_eflag) ND_PRINT((ndo, ", ")); ND_PRINT((ndo, "length %u", olen)); @@ -851,7 +851,7 @@ q933_print(netdissect_options *ndo, non_locking_shift = 0; unshift_codeset = codeset; if (length != 0) { - if (!ND_TTEST(*p)) { + if (!ND_TTEST_1(p)) { if (!ndo->ndo_eflag) ND_PRINT((ndo, ", ")); ND_PRINT((ndo, "length %u", olen)); @@ -952,7 +952,7 @@ q933_print(netdissect_options *ndo, /* * Get the first octet of the IE. */ - if (!ND_TTEST(*p)) { + if (!ND_TTEST_1(p)) { if (!ndo->ndo_vflag) { ND_PRINT((ndo, ", length %u", olen)); } @@ -995,7 +995,7 @@ q933_print(netdissect_options *ndo, /* * No. Get the IE length. */ - if (length == 0 || !ND_TTEST(*p)) { + if (length == 0 || !ND_TTEST_1(p)) { if (!ndo->ndo_vflag) { ND_PRINT((ndo, ", length %u", olen)); } diff --git a/print-ip.c b/print-ip.c index d24f46cc..1e9f1ed9 100644 --- a/print-ip.c +++ b/print-ip.c @@ -346,7 +346,7 @@ again: switch (ipds->nh) { case IPPROTO_AH: - if (!ND_TTEST(*ipds->cp)) { + if (!ND_TTEST_1(ipds->cp)) { ND_PRINT((ndo, "[|AH]")); break; } diff --git a/print-isoclns.c b/print-isoclns.c index a1b4d07d..3d09f994 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -671,7 +671,7 @@ struct isis_tlv_lsp { void isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length) { - if (!ND_TTEST(*p)) { /* enough bytes on the wire ? */ + if (!ND_TTEST_1(p)) { /* enough bytes on the wire ? */ ND_PRINT((ndo, "|OSI")); return; } diff --git a/print-pim.c b/print-pim.c index 8e52de5a..fa6a345a 100644 --- a/print-pim.c +++ b/print-pim.c @@ -259,7 +259,7 @@ pimv1_print(netdissect_options *ndo, ND_PRINT((ndo, " %s", tok2str(pimv1_type_str, "[type %u]", type))); switch (type) { case PIMV1_TYPE_QUERY: - if (ND_TTEST(bp[8])) { + if (ND_TTEST_1(bp + 8)) { switch (EXTRACT_U_1(bp + 8) >> 4) { case 0: ND_PRINT((ndo, " Dense-mode")); diff --git a/print-ppp.c b/print-ppp.c index 3b935ed5..31b87a24 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -1410,7 +1410,7 @@ ppp_hdlc(netdissect_options *ndo, * Do this so that we dont overwrite the original packet * contents. */ - for (s = p, t = b, i = length; i != 0 && ND_TTEST(*s); i--) { + for (s = p, t = b, i = length; i != 0 && ND_TTEST_1(s); i--) { c = EXTRACT_U_1(s); s++; if (c == 0x7d) { diff --git a/util-print.c b/util-print.c index 4ac4bc49..58efc4b4 100644 --- a/util-print.c +++ b/util-print.c @@ -691,7 +691,7 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len, size_t toklen = 0; for (; idx < len; idx++) { - if (!ND_TTEST(*(pptr + idx))) { + if (!ND_TTEST_1(pptr + idx)) { /* ran past end of captured data */ return (0); } @@ -725,7 +725,7 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len, * an end-of-line (CR or LF). */ for (; idx < len; idx++) { - if (!ND_TTEST(*(pptr + idx))) { + if (!ND_TTEST_1(pptr + idx)) { /* ran past end of captured data */ break; }