From: Alessio Podda Date: Sun, 14 Dec 2025 13:21:52 +0000 (+0100) Subject: Fewer name copies in step X-Git-Tag: v9.21.19~27^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33dfd3c0ce616799c04ac92d4e669438a6f8e1b5;p=thirdparty%2Fbind9.git Fewer name copies in step Part of an refactor to eliminate intermediate copies in qpzone_find. --- diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index 7f6cda8c3c4..e73f06ef7db 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -2642,16 +2642,13 @@ typedef enum { FORWARD, BACK } direction_t; static bool step(qpz_search_t *search, dns_qpiter_t *it, direction_t direction, dns_name_t *nextname) { - dns_fixedname_t fnodename; - dns_name_t *nodename = dns_fixedname_initname(&fnodename); - qpznode_t *node = NULL; + qpznode_t *node = NULL, *previous_node = NULL; isc_result_t result = ISC_R_SUCCESS; result = dns_qpiter_current(it, (void **)&node, NULL); - if (result == ISC_R_SUCCESS) { - dns_name_copy(&node->name, nodename); - } while (result == ISC_R_SUCCESS) { + previous_node = node; + isc_rwlock_t *nlock = qpzone_get_lock(node); isc_rwlocktype_t nlocktype = isc_rwlocktype_none; dns_vecheader_t *found = NULL; @@ -2670,13 +2667,11 @@ step(qpz_search_t *search, dns_qpiter_t *it, direction_t direction, } else { result = dns_qpiter_prev(it, (void **)&node, NULL); } - if (result == ISC_R_SUCCESS) { - dns_name_copy(&node->name, nodename); - } }; + if (result == ISC_R_SUCCESS) { - if (nextname != NULL) { - dns_name_copy(nodename, nextname); + if (previous_node != NULL) { + dns_name_copy(&previous_node->name, nextname); } return true; }