rename dns_qp_findname_parent() to _findname_ancestor()
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.
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user