2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 09:05:40 +00:00

Refactor to use list-like macro for message sections

In the code base it is very common to iterate over all names in a message
section and all rdatasets for each name, but various idioms are used for
iteration.

This commit standardizes them as much as possible to a single idiom,
using the macro MSG_SECTION_FOREACH, similar to the existing
ISC_LIST_FOREACH.
This commit is contained in:
alessio
2025-03-19 20:29:17 +01:00
committed by xoranth
parent 52a04a368b
commit 2f27d66450
22 changed files with 246 additions and 656 deletions

View File

@@ -591,14 +591,8 @@ process_section(const section_filter_t *filter) {
bool only_if_aaaa_exists = filter->only_if_aaaa_exists;
dns_message_t *message = qctx->client->message;
isc_result_t result;
for (result = dns_message_firstname(message, section);
result == ISC_R_SUCCESS;
result = dns_message_nextname(message, section))
{
dns_name_t *cur = NULL;
dns_message_currentname(message, section, &cur);
MSG_SECTION_FOREACH (message, section, cur) {
if (name != NULL && !dns_name_equal(name, cur)) {
/*
* We only want to process 'name' and this is not it.