mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
use dns_qp_getname() where possible
some calls to dns_qp_lookup() do not need partial matches, QP chains or QP iterators. in these cases it's more efficient to use dns_qp_getname().
This commit is contained in:
@@ -1499,10 +1499,10 @@ find_coveringnsec(search_t *search, const dns_name_t *name,
|
||||
* Lookup the predecessor in the main tree.
|
||||
*/
|
||||
node = NULL;
|
||||
result = dns_qp_lookup(search->qpdb->tree, predecessor, NULL, NULL,
|
||||
NULL, (void **)&node, NULL);
|
||||
result = dns_qp_getname(search->qpdb->tree, predecessor, (void **)&node,
|
||||
NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
return (result);
|
||||
}
|
||||
dns_name_copy(&node->name, fname);
|
||||
|
||||
@@ -2793,21 +2793,16 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
|
||||
isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
|
||||
|
||||
TREE_RDLOCK(&qpdb->tree_lock, &tlocktype);
|
||||
result = dns_qp_lookup(qpdb->tree, name, NULL, NULL, NULL,
|
||||
(void **)&node, NULL);
|
||||
result = dns_qp_getname(qpdb->tree, name, (void **)&node, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (!create) {
|
||||
if (result == DNS_R_PARTIALMATCH) {
|
||||
result = ISC_R_NOTFOUND;
|
||||
}
|
||||
goto unlock;
|
||||
}
|
||||
/*
|
||||
* Try to upgrade the lock and if that fails unlock then relock.
|
||||
*/
|
||||
TREE_FORCEUPGRADE(&qpdb->tree_lock, &tlocktype);
|
||||
result = dns_qp_lookup(qpdb->tree, name, NULL, NULL, NULL,
|
||||
(void **)&node, NULL);
|
||||
result = dns_qp_getname(qpdb->tree, name, (void **)&node, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
node = new_qpcnode(qpdb, name);
|
||||
result = dns_qp_insert(qpdb->tree, node, 0);
|
||||
|
Reference in New Issue
Block a user