2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

cleanups; change viewlist find routine

This commit is contained in:
Bob Halley 1999-10-15 01:43:39 +00:00
parent df0453520c
commit e7dbdb2547
2 changed files with 20 additions and 17 deletions

View File

@ -301,9 +301,9 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* or an error occurred.
*/
dns_view_t *
dns_view_findinlist(dns_viewlist_t *list, const char *name,
dns_rdataclass_t rdclass);
isc_result_t
dns_viewlist_find(dns_viewlist_t *list, const char *name,
dns_rdataclass_t rdclass, dns_view_t **viewp);
/*
* XXX
*/

View File

@ -264,20 +264,17 @@ dns_view_freeze(dns_view_t *view) {
}
isc_result_t
dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zone) {
dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep) {
isc_result_t result;
dns_zone_t *dummy = NULL;
REQUIRE(DNS_VIEW_VALID(view));
result = dns_zt_find(view->zonetable, name, NULL, &dummy);
result = dns_zt_find(view->zonetable, name, NULL, zonep);
if (result == DNS_R_PARTIALMATCH) {
dns_zone_detach(&dummy);
dns_zone_detach(zonep);
result = DNS_R_NOTFOUND;
} else if (result == DNS_R_SUCCESS) {
dns_zone_attach(dummy, zone);
dns_zone_detach(&dummy);
}
return (result);
}
@ -431,18 +428,24 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
return (result);
}
dns_view_t *
dns_view_findinlist(dns_viewlist_t *list, const char *name,
dns_rdataclass_t rdclass) {
isc_result_t
dns_viewlist_find(dns_viewlist_t *list, const char *name,
dns_rdataclass_t rdclass, dns_view_t **viewp)
{
dns_view_t *view;
REQUIRE(list != NULL);
view = ISC_LIST_HEAD(*list);
while (view != NULL) {
for (view = ISC_LIST_HEAD(*list);
view != NULL;
view = ISC_LIST_NEXT(view, link)) {
if (strcmp(view->name, name) == 0 && view->rdclass == rdclass)
break;
view = ISC_LIST_NEXT(view, link);
}
return (view);
if (view == NULL)
return (ISC_R_NOTFOUND);
dns_view_attach(view, viewp);
return (ISC_R_SUCCESS);
}