}
static isc_result_t
-is_empty(const vctx_t *vctx, dns_dbnode_t *node, bool *empty) {
+is_empty(const vctx_t *vctx, dns_dbnode_t *node) {
dns_rdatasetiter_t *rdsiter = NULL;
isc_result_t result;
result = dns_rdatasetiter_first(rdsiter);
dns_rdatasetiter_destroy(&rdsiter);
- *empty = (result == ISC_R_NOMORE);
-
- return (ISC_R_SUCCESS);
+ return (result);
}
static isc_result_t
nextnode = NULL;
result = dns_dbiterator_next(dbiter);
while (result == ISC_R_SUCCESS) {
- bool empty;
result = dns_dbiterator_current(dbiter, &nextnode,
nextname);
if (result != ISC_R_SUCCESS &&
result = dns_dbiterator_next(dbiter);
continue;
}
- result = is_empty(vctx, nextnode, &empty);
+ result = is_empty(vctx, nextnode);
dns_db_detachnode(vctx->db, &nextnode);
- if (result != ISC_R_SUCCESS) {
- dns_db_detachnode(vctx->db, &node);
- goto done;
- }
- if (empty) {
+ switch (result) {
+ case ISC_R_SUCCESS:
+ break;
+ case ISC_R_NOMORE:
result = dns_dbiterator_next(dbiter);
continue;
+ default:
+ dns_db_detachnode(vctx->db, &node);
}
break;
}