From: Alessio Podda Date: Wed, 3 Sep 2025 22:15:38 +0000 (+0200) Subject: fixup! fixup! fixup! fixup! Add slabheader foreach macro X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14e7cfe637590883afab57893df102d0899b59b6;p=thirdparty%2Fbind9.git fixup! fixup! fixup! fixup! Add slabheader foreach macro --- diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index c6da3563be1..45c0b2e5485 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -2662,19 +2662,22 @@ step(qpz_search_t *search, dns_qpiter_t *it, direction_t direction, while (result == ISC_R_SUCCESS) { isc_rwlock_t *nlock = qpzone_get_lock(node); isc_rwlocktype_t nlocktype = isc_rwlocktype_none; - dns_slabheader_t *found = NULL; NODE_RDLOCK(nlock, &nlocktype); + + dns_slabheader_t *found = NULL; DNS_SLABTOP_FOREACH(top, node->data) { - dns_slabheader_t *header = top->header; - while (header != NULL && - (IGNORE(header) || - header->serial > search->serial)) - { - header = header->down; + SLABHEADER_FOREACH_SAFE(top->header, inner, down) { + if (inner->serial <= search->serial && + !IGNORE(inner)) + { + if (EXISTS(inner)) { + found = inner; + } + break; + } } - if (header != NULL && EXISTS(header)) { - found = header; + if (found != NULL) { break; } } @@ -3046,35 +3049,34 @@ again: NODE_RDLOCK(nlock, &nlocktype); empty_node = true; DNS_SLABTOP_FOREACH(top, node->data) { - dns_slabheader_t *header = top->header; + /* * Look for an active, extant NSEC or RRSIG NSEC. */ - do { - if (header->serial <= search->serial && - !IGNORE(header)) + dns_slabheader_t *candidate = NULL; + SLABHEADER_FOREACH_SAFE(top->header, inner, down) { + if (inner->serial <= search->serial && + !IGNORE(inner)) { - if (!EXISTS(header)) { - header = NULL; + if (EXISTS(inner)) { + candidate = inner; } break; - } else { - header = header->down; } - } while (header != NULL); - if (header != NULL) { + } + if (candidate != NULL) { /* * We now know that there is at least one * active rdataset at this node. */ empty_node = false; if (top->typepair == typepair) { - found = header; + found = candidate; if (foundsig != NULL) { break; } } else if (top->typepair == sigpair) { - foundsig = header; + foundsig = candidate; if (found != NULL) { break; }