2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Remove double non-NULL guard around bindrdataset()

The bindrdataset() already has a logic to skip the rest of the function
if the passed rdataset is NULL.  Remove the external guarding for
'addedrdataset' to simplify the code flow both from the zone and cache
databases.
This commit is contained in:
Ondřej Surý
2025-08-21 08:56:29 +02:00
parent bc5c9cf62b
commit c60bdbcf5c
2 changed files with 17 additions and 31 deletions

View File

@@ -2667,14 +2667,11 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader,
* The NXDOMAIN/NODATA(QTYPE=ANY) * The NXDOMAIN/NODATA(QTYPE=ANY)
* is more trusted. * is more trusted.
*/ */
if (addedrdataset != NULL) { bindrdataset(
bindrdataset( qpdb, qpnode, top->header, now,
qpdb, qpnode, nlocktype, tlocktype,
top->header, now, addedrdataset
nlocktype, tlocktype, DNS__DB_FLARG_PASS);
addedrdataset
DNS__DB_FLARG_PASS);
}
return DNS_R_UNCHANGED; return DNS_R_UNCHANGED;
} }
/* /*
@@ -2725,11 +2722,9 @@ find_header:
if (trust < header->trust && if (trust < header->trust &&
(ACTIVE(header, now) || !EXISTS(header))) (ACTIVE(header, now) || !EXISTS(header)))
{ {
if (addedrdataset != NULL) { bindrdataset(qpdb, qpnode, header, now, nlocktype,
bindrdataset(qpdb, qpnode, header, now, tlocktype,
nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS);
addedrdataset DNS__DB_FLARG_PASS);
}
return DNS_R_UNCHANGED; return DNS_R_UNCHANGED;
} }
@@ -2764,11 +2759,9 @@ find_header:
header->closest = newheader->closest; header->closest = newheader->closest;
newheader->closest = NULL; newheader->closest = NULL;
} }
if (addedrdataset != NULL) { bindrdataset(qpdb, qpnode, header, now, nlocktype,
bindrdataset(qpdb, qpnode, header, now, tlocktype,
nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS);
addedrdataset DNS__DB_FLARG_PASS);
}
return DNS_R_UNCHANGED; return DNS_R_UNCHANGED;
} }
@@ -2816,11 +2809,9 @@ find_header:
header->closest = newheader->closest; header->closest = newheader->closest;
newheader->closest = NULL; newheader->closest = NULL;
} }
if (addedrdataset != NULL) { bindrdataset(qpdb, qpnode, header, now, nlocktype,
bindrdataset(qpdb, qpnode, header, now, tlocktype,
nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS);
addedrdataset DNS__DB_FLARG_PASS);
}
return DNS_R_UNCHANGED; return DNS_R_UNCHANGED;
} }
@@ -2893,10 +2884,8 @@ find_header:
} }
} }
if (addedrdataset != NULL) { bindrdataset(qpdb, qpnode, newheader, now, nlocktype, tlocktype,
bindrdataset(qpdb, qpnode, newheader, now, nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS);
addedrdataset DNS__DB_FLARG_PASS);
}
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }

View File

@@ -2053,10 +2053,7 @@ add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename,
return DNS_R_CNAMEANDOTHER; return DNS_R_CNAMEANDOTHER;
} }
if (addedrdataset != NULL) { bindrdataset(qpdb, node, newheader, addedrdataset DNS__DB_FLARG_PASS);
bindrdataset(qpdb, node, newheader,
addedrdataset DNS__DB_FLARG_PASS);
}
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }