Commit d7017005 authored by Thomas Haller's avatar Thomas Haller
Browse files

dns: use NM_CMP_*() macros sorting IP config in DNS manager

parent ad10e79a
......@@ -312,37 +312,23 @@ _config_data_free (NMDnsConfigData *data)
}
static int
_ip_config_data_cmp (const NMDnsIPConfigData *a, const NMDnsIPConfigData *b)
_ip_config_lst_cmp (const CList *a_lst,
const CList *b_lst,
const void *user_data)
{
int a_prio, b_prio;
a_prio = nm_ip_config_get_dns_priority (a->ip_config);
b_prio = nm_ip_config_get_dns_priority (b->ip_config);
const NMDnsIPConfigData *a = c_list_entry (a_lst, NMDnsIPConfigData, ip_config_lst);
const NMDnsIPConfigData *b = c_list_entry (b_lst, NMDnsIPConfigData, ip_config_lst);
/* Configurations with lower priority value first */
if (a_prio < b_prio)
return -1;
else if (a_prio > b_prio)
return 1;
NM_CMP_DIRECT (nm_ip_config_get_dns_priority (a->ip_config),
nm_ip_config_get_dns_priority (b->ip_config));
/* Sort also according to type */
if (a->ip_config_type > b->ip_config_type)
return -1;
else if (a->ip_config_type < b->ip_config_type)
return 1;
NM_CMP_DIRECT (a->ip_config_type, b->ip_config_type);
return 0;
}
static int
_ip_config_lst_cmp (const CList *a,
const CList *b,
const void *user_data)
{
return _ip_config_data_cmp (c_list_entry (a, NMDnsIPConfigData, ip_config_lst),
c_list_entry (b, NMDnsIPConfigData, ip_config_lst));
}
static CList *
_ip_config_lst_head (NMDnsManager *self)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment