Skip to content
Snippets Groups Projects
Commit c302c030 authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Use binary compare when sorting RRs in RRSet.

Refs #4
parent 590af604
No related branches found
No related tags found
No related merge requests found
......@@ -569,7 +569,6 @@ int knot_dname_cmp_wire(const knot_dname_t *d1, const knot_dname_t *d2,
return 0;
}
/*----------------------------------------------------------------------------*/
bool knot_dname_is_equal(const knot_dname_t *d1, const knot_dname_t *d2)
......
......@@ -188,9 +188,15 @@ static int rrset_rdata_compare_one(const knot_rrset_t *rrset1,
if (descriptor_item_is_dname(desc->block_types[i])) {
knot_dname_t *dname1 = NULL;
memcpy(&dname1, r1 + offset, sizeof(knot_dname_t *));
int size1 = knot_dname_size(dname1);
knot_dname_t *dname2 = NULL;
int size2 = knot_dname_size(dname2);
memcpy(&dname2, r2 + offset, sizeof(knot_dname_t *));
cmp = knot_dname_cmp(dname1, dname2);
cmp = memcmp(dname1, dname2,
size1 <= size2 ? size1 : size2);
if (cmp == 0 && size1 != size2) {
cmp = size1 < size2 ? -1 : 1;
}
offset += sizeof(knot_dname_t *);
} else if (descriptor_item_is_fixed(desc->block_types[i])) {
cmp = memcmp(r1 + offset, r2 + offset,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment