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

a better fix than the last for dns_rbtnodechain_next

This commit is contained in:
David Lawrence 1999-04-22 14:36:30 +00:00
parent 2292bceadf
commit 55f6206532

View File

@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: rbt.c,v 1.46 1999/04/22 14:16:52 tale Exp $ */ /* $Id: rbt.c,v 1.47 1999/04/22 14:36:30 tale Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@ -2076,11 +2076,14 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name,
} }
} }
if (successor == NULL && chain->level_count > 0) { if (successor == NULL) {
/* /*
* Reached the root without having traversed * Reached the root without having traversed
* any left pointers, so this level is done. * any left pointers, so this level is done.
*/ */
if (chain->level_count == 0)
break;
INSIST(chain->ancestor_count > 0); INSIST(chain->ancestor_count > 0);
current = chain->levels[--chain->level_count]; current = chain->levels[--chain->level_count];
chain->ancestor_count--; chain->ancestor_count--;
@ -2089,7 +2092,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name,
if (RIGHT(current) != NULL) if (RIGHT(current) != NULL)
break; break;
} }
} while (successor == NULL && chain->level_count > 0); } while (successor == NULL);
} }
if (successor == NULL && RIGHT(current) != NULL) { if (successor == NULL && RIGHT(current) != NULL) {
@ -2108,7 +2111,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name,
chain->end = successor; chain->end = successor;
/* /*
* It is not necessary to use dns_rbtnodechain_next like * It is not necessary to use dns_rbtnodechain_current like
* the other functions because this function will never * the other functions because this function will never
* find a node in the topmost level. This is because the * find a node in the topmost level. This is because the
* root level will never be more than one name, and everything * root level will never be more than one name, and everything