Logo Search packages:      
Sourcecode: ldns version File versions  Download package

bool ldns_rr_list_push_rr ( ldns_rr_list rr_list,
const ldns_rr rr 
)

pushes an rr to an rrlist.

Parameters:
[in] rr_list the rr_list to push to
[in] rr the rr to push
Returns:
false on error, otherwise true

Definition at line 866 of file rr.c.

References ldns_struct_rr_list::_rr_capacity, ldns_struct_rr_list::_rrs, ldns_rr_list_push_rr(), ldns_rr_list_rr_count(), and ldns_rr_list_set_rr_count().

Referenced by ldns_get_rr_list_addr_by_name(), ldns_get_rr_list_hosts_frm_fp_l(), ldns_pkt_push_rr(), ldns_pkt_rr_list_by_name(), ldns_pkt_rr_list_by_name_and_type(), ldns_pkt_rr_list_by_type(), ldns_rr_list_cat(), ldns_rr_list_cat_clone(), ldns_rr_list_clone(), ldns_rr_list_pop_rr_list(), ldns_rr_list_pop_rrset(), ldns_rr_list_push_rr(), ldns_rr_list_push_rr_list(), ldns_rr_list_subtype_by_rdf(), ldns_rr_set_push_rr(), ldns_wire2pkt(), ldns_zone_glue_rr_list(), and ldns_zone_push_rr().

{
      size_t rr_count;
      size_t cap;
      
      rr_count = ldns_rr_list_rr_count(rr_list);
      cap = rr_list->_rr_capacity;

      /* grow the array */
      if(rr_count+1 > cap) {
            ldns_rr **rrs;

            if(cap == 0)
                  cap = LDNS_RRLIST_INIT;  /* initial list size */
            else  cap *= 2; 
            rrs = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap);
            if (!rrs) {
                  return false;
            }
            rr_list->_rrs = rrs;
            rr_list->_rr_capacity = cap;
      }
      
      /* add the new member */
      rr_list->_rrs[rr_count] = (ldns_rr*)rr;

      ldns_rr_list_set_rr_count(rr_list, rr_count + 1);
      return true;
}


Generated by  Doxygen 1.6.0   Back to index