]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
rename dns_qp_findname_parent() to _findname_ancestor()
authorEvan Hunt <each@isc.org>
Wed, 5 Apr 2023 07:36:37 +0000 (00:36 -0700)
committerOndřej Surý <ondrej@isc.org>
Tue, 15 Aug 2023 12:24:46 +0000 (14:24 +0200)
this function finds the closest matching ancestor, but the function
name could be read to imply that it returns the direct parent node;
this commit suggests a slightly less misleading name.

lib/dns/include/dns/qp.h
lib/dns/qp.c
lib/dns/zt.c
tests/dns/qp_test.c

index 786c8f606459d43704a6a247cee50b540c09f5f2..2801c4904046d2c674b50494b357ca0701ea5e23 100644 (file)
@@ -267,7 +267,7 @@ typedef enum dns_qpgc {
 } dns_qpgc_t;
 
 /*%
- * Options for fancy searches such as `dns_qp_findname_parent()`
+ * Options for fancy searches such as `dns_qp_findname_ancestor()`
  */
 typedef enum dns_qpfind {
        DNS_QPFIND_NOEXACT = 1 << 0,
@@ -468,14 +468,14 @@ dns_qp_getname(dns_qpreadable_t qpr, const dns_name_t *name, void **pval_r,
  */
 
 isc_result_t
-dns_qp_findname_parent(dns_qpreadable_t qpr, const dns_name_t *name,
-                      dns_qpfind_t options, void **pval_r, uint32_t *ival_r);
+dns_qp_findname_ancestor(dns_qpreadable_t qpr, const dns_name_t *name,
+                        dns_qpfind_t options, void **pval_r, uint32_t *ival_r);
 /*%<
- * Find a leaf in a qp-trie that is a parent domain of or equal to the
+ * Find a leaf in a qp-trie that is an ancestor domain of, or equal to, the
  * given DNS name.
  *
- * If the DNS_QPFIND_NOEXACT option is set, find a strict parent
- * domain not equal to the search name.
+ * If the DNS_QPFIND_NOEXACT option is set, find the closest ancestor
+ * domain that is not equal to the search name.
  *
  * The leaf values are assigned to whichever of `*pval_r` and `*ival_r`
  * are not null, unless the return value is ISC_R_NOTFOUND.
@@ -486,7 +486,7 @@ dns_qp_findname_parent(dns_qpreadable_t qpr, const dns_name_t *name,
  *
  * Returns:
  * \li  ISC_R_SUCCESS if an exact match was found
- * \li  ISC_R_PARTIALMATCH if a parent domain was found
+ * \li  ISC_R_PARTIALMATCH if an ancestor domain was found
  * \li  ISC_R_NOTFOUND if no match was found
  */
 
index 6b56310273201a6044ade903120ae8def03dd1db..e416bf80851a3275953a5b044eee5d5b48e9fa19 100644 (file)
@@ -1810,8 +1810,9 @@ dns_qp_getname(dns_qpreadable_t qpr, const dns_name_t *name, void **pval_r,
 }
 
 isc_result_t
-dns_qp_findname_parent(dns_qpreadable_t qpr, const dns_name_t *name,
-                      dns_qpfind_t options, void **pval_r, uint32_t *ival_r) {
+dns_qp_findname_ancestor(dns_qpreadable_t qpr, const dns_name_t *name,
+                        dns_qpfind_t options, void **pval_r,
+                        uint32_t *ival_r) {
        dns_qpreader_t *qp = dns_qpreader(qpr);
        dns_qpkey_t search, found;
        size_t searchlen, foundlen;
index 648c49436b7c200de4529e1e2feab1001303811f..7f2cedadd3c9e7686d683b76a697ffc83dd3d45b 100644 (file)
@@ -180,10 +180,10 @@ dns_zt_find(dns_zt_t *zt, const dns_name_t *name, dns_ztfind_t options,
        if (exactopts == DNS_ZTFIND_EXACT) {
                result = dns_qp_getname(&qpr, name, &pval, NULL);
        } else if (exactopts == DNS_ZTFIND_NOEXACT) {
-               result = dns_qp_findname_parent(&qpr, name, DNS_QPFIND_NOEXACT,
-                                               &pval, NULL);
+               result = dns_qp_findname_ancestor(
+                       &qpr, name, DNS_QPFIND_NOEXACT, &pval, NULL);
        } else {
-               result = dns_qp_findname_parent(&qpr, name, 0, &pval, NULL);
+               result = dns_qp_findname_ancestor(&qpr, name, 0, &pval, NULL);
        }
        dns_qpread_destroy(zt->multi, &qpr);
 
index e2bc50bd9c3774ce21e457061e665b05e724eed8..4d30f74b522b6cd700a9276a203b05adbdad8263 100644 (file)
@@ -268,8 +268,8 @@ check_partialmatch(dns_qp_t *qp, struct check_partialmatch check[]) {
                        check[i].found);
 #endif
                dns_test_namefromstring(check[i].query, &fixed);
-               result = dns_qp_findname_parent(qp, name, check[i].options,
-                                               &pval, NULL);
+               result = dns_qp_findname_ancestor(qp, name, check[i].options,
+                                                 &pval, NULL);
                assert_int_equal(result, check[i].result);
                if (check[i].found == NULL) {
                        assert_null(pval);