From afda57a68eb6cbea53cb74905cb4d2faeed8ed36 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Mon, 20 Mar 2000 16:57:46 +0000 Subject: [PATCH] changes from code review: use ISC_LIST_EMPTY(msg->sections[i]) rather than msg->counts[i] > 0 to determine whether a section is empty, since the count field does not track pseudosections --- bin/tests/printmsg.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/tests/printmsg.c b/bin/tests/printmsg.c index d040e7c8fe..286eb16e88 100644 --- a/bin/tests/printmsg.c +++ b/bin/tests/printmsg.c @@ -196,35 +196,34 @@ printmessage(dns_message_t *msg) { (unsigned int)((opt->ttl & 0x00ff0000) >> 16), (unsigned int)opt->rdclass); - if (msg->counts[DNS_SECTION_TSIG] > 0) - printf(";; PSEUDOSECTIONS: TSIG: %u\n", - msg->counts[DNS_SECTION_TSIG]); - if (msg->counts[DNS_SECTION_QUESTION] > 0) { + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_TSIG])) + printf(";; PSEUDOSECTIONS: TSIG\n"); + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION])) { printf("\n"); result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION"); if (result != DNS_R_SUCCESS) return (result); } - if (msg->counts[DNS_SECTION_ANSWER] > 0) { + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) { printf("\n"); result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER"); if (result != DNS_R_SUCCESS) return (result); } - if (msg->counts[DNS_SECTION_AUTHORITY] > 0) { + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY])) { printf("\n"); result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY"); if (result != DNS_R_SUCCESS) return (result); } - if (msg->counts[DNS_SECTION_ADDITIONAL] > 0) { + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL])) { printf("\n"); result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL"); if (result != DNS_R_SUCCESS) return (result); } - if (msg->counts[DNS_SECTION_TSIG] > 0) { + if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_TSIG])) { printf("\n"); result = printsection(msg, DNS_SECTION_TSIG, "PSEUDOSECTION TSIG");