lib/dns/master.c
/*
 * Grow the slab of rdata structs.
 * Re-link the current and glue chains.
 */
Grow the slab of rdata structs.
Re-link the current and glue chains.
Grow the slab of rdata structs . Re - link the current and glue chains .
static dns_rdata_t *
grow_rdata(int new_len, dns_rdata_t *old, int old_len,
	   rdatalist_head_t *current, rdatalist_head_t *glue,
	   isc_mem_t *mctx)
{
	dns_rdata_t *new;
	int rdcount = 0;
	ISC_LIST(dns_rdata_t) save;
	dns_rdatalist_t *this;
	dns_rdata_t *rdata;
	new = isc_mem_get(mctx, new_len * sizeof(*new));
	if (new == NULL)
		return (NULL);
	memset(new, 0, new_len * sizeof(*new));
	this = ISC_LIST_HEAD(*current);
	while (this != NULL) {
		ISC_LIST_INIT(save);
		while ((rdata = ISC_LIST_HEAD(this->rdata)) != NULL) {
			ISC_LIST_UNLINK(this->rdata, rdata, link);
			ISC_LIST_APPEND(save, rdata, link);
		}
		while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
			ISC_LIST_UNLINK(save, rdata, link);
			new[rdcount] = *rdata;
			ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
			rdcount++;
		}
		this = ISC_LIST_NEXT(this, link);
	}
	this = ISC_LIST_HEAD(*glue);
	while (this != NULL) {
		ISC_LIST_INIT(save);
		while ((rdata = ISC_LIST_HEAD(this->rdata)) != NULL) {
			ISC_LIST_UNLINK(this->rdata, rdata, link);
			ISC_LIST_APPEND(save, rdata, link);
		}
		while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
			ISC_LIST_UNLINK(save, rdata, link);
			new[rdcount] = *rdata;
			ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
			rdcount++;
		}
		this = ISC_LIST_NEXT(this, link);
	}
	INSIST(rdcount == old_len);
	if (old != NULL)
		isc_mem_put(mctx, old, old_len * sizeof(*old));
	return (new);
}
static dns_rdata_t * grow_rdata ( int new_len , dns_rdata_t * old , int old_len , rdatalist_head_t * current , rdatalist_head_t * glue , isc_mem_t * mctx ) { dns_rdata_t * new ; int rdcount = 0 ; ISC_LIST ( dns_rdata_t ) save ; dns_rdatalist_t * this ; dns_rdata_t * rdata ; new = isc_mem_get ( mctx , new_len * sizeof ( * new ) ) ; if ( new == NULL ) return ( NULL ) ; memset ( new , 0 , new_len * sizeof ( * new ) ) ; this = ISC_LIST_HEAD ( * current ) ; while ( this != NULL ) { ISC_LIST_INIT ( save ) ; while ( ( rdata = ISC_LIST_HEAD ( this -> rdata ) ) != NULL ) { ISC_LIST_UNLINK ( this -> rdata , rdata , link ) ; ISC_LIST_APPEND ( save , rdata , link ) ; } while ( ( rdata = ISC_LIST_HEAD ( save ) ) != NULL ) { ISC_LIST_UNLINK ( save , rdata , link ) ; new [ rdcount ] = * rdata ; ISC_LIST_APPEND ( this -> rdata , & new [ rdcount ] , link ) ; rdcount ++ ; } this = ISC_LIST_NEXT ( this , link ) ; } this = ISC_LIST_HEAD ( * glue ) ; while ( this != NULL ) { ISC_LIST_INIT ( save ) ; while ( ( rdata = ISC_LIST_HEAD ( this -> rdata ) ) != NULL ) { ISC_LIST_UNLINK ( this -> rdata , rdata , link ) ; ISC_LIST_APPEND ( save , rdata , link ) ; } while ( ( rdata = ISC_LIST_HEAD ( save ) ) != NULL ) { ISC_LIST_UNLINK ( save , rdata , link ) ; new [ rdcount ] = * rdata ; ISC_LIST_APPEND ( this -> rdata , & new [ rdcount ] , link ) ; rdcount ++ ; } this = ISC_LIST_NEXT ( this , link ) ; } INSIST ( rdcount == old_len ) ; if ( old != NULL ) isc_mem_put ( mctx , old , old_len * sizeof ( * old ) ) ; return ( new ) ; }
Grow the slab of rdata structs.
Grow the slab of rdata structs .
/*
	 * Copy current relinking.
	 */ /*
	 * Copy glue relinking.
	 */