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

ldns_rr_list* ldns_rr_list_clone ( ldns_rr_list rrlist  ) 

clones an rrlist.

Parameters:
[in] rrlist the rrlist to clone
Returns:
the cloned rr list

Definition at line 1156 of file rr.c.

References ldns_rr_clone(), ldns_rr_list_clone(), ldns_rr_list_free(), 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(), ldns_pkt_clone(), ldns_pkt_get_section_clone(), ldns_rr_list_cat_clone(), ldns_rr_list_clone(), and ldns_update_pkt_new().

{
      size_t i;
      ldns_rr_list *new_list;
      ldns_rr *r;

      if (!rrlist) {
            return NULL;
      }

      new_list = ldns_rr_list_new();
      if (!new_list) {
            return NULL;
      }
      for (i = 0; i < ldns_rr_list_rr_count(rrlist); i++) {
            r = ldns_rr_clone(
                  ldns_rr_list_rr(rrlist, i)
                );
            if (!r) {
                  /* huh, failure in cloning */
                  ldns_rr_list_free(new_list);
                  return NULL;
            }
            ldns_rr_list_push_rr(new_list, r);
      }
      return new_list;
}


Generated by  Doxygen 1.6.0   Back to index