{
struct cache_record *l = avl_find_element(&records, record, l, avl);
- if (!l)
- return NULL;
-
- while (l && !avl_is_last(&records, &l->avl) && !strcmp(l->record, record)) {
+ while (l && !strcmp(l->record, record)) {
struct cache_record *r = l;
- l = avl_next_element(l, avl);
+ l = !avl_is_last(&records, &l->avl) ? avl_next_element(l, avl) : NULL;
if (r->type != type)
continue;
{
struct cache_record *l = avl_find_element(&records, record, l, avl);
- if (!l)
- return 0;
-
- while (l && !avl_is_last(&records, &l->avl) && !strcmp(l->record, record)) {
+ while (l && !strcmp(l->record, record)) {
struct cache_record *r = l;
- l = avl_next_element(l, avl);
+ l = !avl_is_last(&records, &l->avl) ? avl_next_element(l, avl) : NULL;
if ((r->type != TYPE_A) && (r->type != TYPE_AAAA))
continue;
return 1;