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

int ldns_rr_list_compare ( const ldns_rr_list rrl1,
const ldns_rr_list rrl2 
)

compares two rr listss.

Parameters:
[in] rrl1 the first one
[in] rrl2 the second one
Returns:
0 if equal -1 if rrl1 comes before rrl2 +1 if rrl2 comes before rrl1

Definition at line 1441 of file rr.c.

References ldns_rr_compare(), ldns_rr_list_compare(), ldns_rr_list_rr(), and ldns_rr_list_rr_count().

Referenced by ldns_rr_list_compare().

{
      size_t i = 0;
      int rr_cmp;

      assert(rrl1 != NULL);
      assert(rrl2 != NULL);

      for (i = 0; i < ldns_rr_list_rr_count(rrl1) && i < ldns_rr_list_rr_count(rrl2); i++) {
            rr_cmp = ldns_rr_compare(ldns_rr_list_rr(rrl1, i), ldns_rr_list_rr(rrl2, i));
            if (rr_cmp != 0) {
                  return rr_cmp;
            }
      }

      if (i == ldns_rr_list_rr_count(rrl1) &&
          i != ldns_rr_list_rr_count(rrl2)) {
            return 1;
      } else if (i == ldns_rr_list_rr_count(rrl2) &&
                 i != ldns_rr_list_rr_count(rrl1)) {
            return -1;
      } else {
            return 0;
      }
}


Generated by  Doxygen 1.6.0   Back to index