lib/dns/master.c
/*
 * Grow the slab of dns_rdatalist_t structures.
 * Re-link glue and current list.
 */
Grow the slab of dns_rdatalist_t structures.
Re-link glue and current list.
Grow the slab of dns_rdatalist_t structures . Re - link glue and current list .
static dns_rdatalist_t *
grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
	       rdatalist_head_t *current, rdatalist_head_t *glue,
	       isc_mem_t *mctx)
{
	dns_rdatalist_t *new;
	int rdlcount = 0;
	ISC_LIST(dns_rdatalist_t) save;
	dns_rdatalist_t *this;
	new = isc_mem_get(mctx, new_len * sizeof(*new));
	if (new == NULL)
		return (NULL);
	ISC_LIST_INIT(save);
	while ((this = ISC_LIST_HEAD(*current)) != NULL) {
		ISC_LIST_UNLINK(*current, this, link);
		ISC_LIST_APPEND(save, this, link);
	}
	while ((this = ISC_LIST_HEAD(save)) != NULL) {
		ISC_LIST_UNLINK(save, this, link);
		new[rdlcount] = *this;
		ISC_LIST_APPEND(*current, &new[rdlcount], link);
		rdlcount++;
	}
	ISC_LIST_INIT(save);
	while ((this = ISC_LIST_HEAD(*glue)) != NULL) {
		ISC_LIST_UNLINK(*glue, this, link);
		ISC_LIST_APPEND(save, this, link);
	}
	while ((this = ISC_LIST_HEAD(save)) != NULL) {
		ISC_LIST_UNLINK(save, this, link);
		new[rdlcount] = *this;
		ISC_LIST_APPEND(*glue, &new[rdlcount], link);
		rdlcount++;
	}
	INSIST(rdlcount == old_len);
	if (old != NULL)
		isc_mem_put(mctx, old, old_len * sizeof(*old));
	return (new);
}
static dns_rdatalist_t * grow_rdatalist ( int new_len , dns_rdatalist_t * old , int old_len , rdatalist_head_t * current , rdatalist_head_t * glue , isc_mem_t * mctx ) { dns_rdatalist_t * new ; int rdlcount = 0 ; ISC_LIST ( dns_rdatalist_t ) save ; dns_rdatalist_t * this ; new = isc_mem_get ( mctx , new_len * sizeof ( * new ) ) ; if ( new == NULL ) return ( NULL ) ; ISC_LIST_INIT ( save ) ; while ( ( this = ISC_LIST_HEAD ( * current ) ) != NULL ) { ISC_LIST_UNLINK ( * current , this , link ) ; ISC_LIST_APPEND ( save , this , link ) ; } while ( ( this = ISC_LIST_HEAD ( save ) ) != NULL ) { ISC_LIST_UNLINK ( save , this , link ) ; new [ rdlcount ] = * this ; ISC_LIST_APPEND ( * current , & new [ rdlcount ] , link ) ; rdlcount ++ ; } ISC_LIST_INIT ( save ) ; while ( ( this = ISC_LIST_HEAD ( * glue ) ) != NULL ) { ISC_LIST_UNLINK ( * glue , this , link ) ; ISC_LIST_APPEND ( save , this , link ) ; } while ( ( this = ISC_LIST_HEAD ( save ) ) != NULL ) { ISC_LIST_UNLINK ( save , this , link ) ; new [ rdlcount ] = * this ; ISC_LIST_APPEND ( * glue , & new [ rdlcount ] , link ) ; rdlcount ++ ; } INSIST ( rdlcount == old_len ) ; if ( old != NULL ) isc_mem_put ( mctx , old , old_len * sizeof ( * old ) ) ; return ( new ) ; }
Grow the slab of dns_rdatalist_t structures.
Grow the slab of dns_rdatalist_t structures .