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

ldns_rr_list* ldns_rr_list_cat_clone ( ldns_rr_list left,
ldns_rr_list right 
)

concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying).

Parameters:
[in] left the leftside
[in] right the rightside
Returns:
a new rr_list with leftside/rightside concatenated

Definition at line 793 of file rr.c.

References ldns_rr_clone(), ldns_rr_list_cat_clone(), ldns_rr_list_clone(), ldns_rr_list_new(), ldns_rr_list_push_rr(), ldns_rr_list_rr(), and ldns_rr_list_rr_count().

Referenced by ldns_get_rr_list_addr_by_name(), and ldns_rr_list_cat_clone().

{
      size_t l_rr_count;
      size_t r_rr_count;
      size_t i;
      ldns_rr_list *cat;

      l_rr_count = 0;

      if (left) {
            l_rr_count = ldns_rr_list_rr_count(left);
      } else {
            return ldns_rr_list_clone(right);
      }

      if (right) {
            r_rr_count = ldns_rr_list_rr_count(right);
      } else {
            r_rr_count = 0;
      }
      
      cat = ldns_rr_list_new();

      if (!cat) {
            return NULL;
      }

      /* left */
      for(i = 0; i < l_rr_count; i++) {
            ldns_rr_list_push_rr(cat, 
                        ldns_rr_clone(ldns_rr_list_rr(left, i)));
      }
      /* right */
      for(i = 0; i < r_rr_count; i++) {
            ldns_rr_list_push_rr(cat, 
                        ldns_rr_clone(ldns_rr_list_rr(right, i)));
      }
      return cat;
}


Generated by  Doxygen 1.6.0   Back to index