mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
add DNS_RDATASET_FOREACH macro
replace the pattern `for (result = dns_rdataset_first(x); result == ISC_R_SUCCES; result = dns_rdataset_next(x)` with a new `DNS_RDATASET_FOREACH` macro throughout BIND.
This commit is contained in:
@@ -316,9 +316,7 @@ static isc_result_t
|
||||
foreach_node_rr_action(void *data, dns_rdataset_t *rdataset) {
|
||||
isc_result_t result;
|
||||
foreach_node_rr_ctx_t *ctx = data;
|
||||
for (result = dns_rdataset_first(rdataset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdataset))
|
||||
{
|
||||
DNS_RDATASET_FOREACH (rdataset) {
|
||||
rr_t rr = { 0, DNS_RDATA_INIT };
|
||||
|
||||
dns_rdataset_current(rdataset, &rr.rdata);
|
||||
@@ -328,9 +326,7 @@ foreach_node_rr_action(void *data, dns_rdataset_t *rdataset) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -456,9 +452,7 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
|
||||
goto cleanup_node;
|
||||
}
|
||||
|
||||
for (result = dns_rdataset_first(&rdataset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset))
|
||||
{
|
||||
DNS_RDATASET_FOREACH (&rdataset) {
|
||||
rr_t rr = { 0, DNS_RDATA_INIT };
|
||||
dns_rdataset_current(&rdataset, &rr.rdata);
|
||||
rr.ttl = rdataset.ttl;
|
||||
@@ -467,9 +461,7 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
|
||||
goto cleanup_rdataset;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
goto cleanup_rdataset;
|
||||
}
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup_rdataset:
|
||||
@@ -1291,7 +1283,6 @@ del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
|
||||
isc_result_t result;
|
||||
dns_dbnode_t *node = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
unsigned int i;
|
||||
dns_rdata_rrsig_t rrsig;
|
||||
bool found;
|
||||
@@ -1317,9 +1308,8 @@ del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
|
||||
goto failure;
|
||||
}
|
||||
|
||||
for (result = dns_rdataset_first(&rdataset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&rdataset))
|
||||
{
|
||||
DNS_RDATASET_FOREACH (&rdataset) {
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
result = dns_rdata_tostruct(&rdata, &rrsig, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
@@ -1356,9 +1346,7 @@ del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
|
||||
}
|
||||
}
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
if (result == ISC_R_NOMORE) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
failure:
|
||||
if (node != NULL) {
|
||||
dns_db_detachnode(db, &node);
|
||||
|
Reference in New Issue
Block a user