/* Recheck /etc/hosts at most once every 2s */
#define ETC_HOSTS_RECHECK_USEC (2*USEC_PER_SEC)
-static void etc_hosts_item_free(EtcHostsItem *item) {
+static void etc_hosts_item_by_address_free(EtcHostsItemByAddress *item) {
strv_free(item->names);
free(item);
}
void etc_hosts_clear(EtcHosts *hosts) {
assert(hosts);
- hosts->by_address = hashmap_free_with_destructor(hosts->by_address, etc_hosts_item_free);
+ hosts->by_address = hashmap_free_with_destructor(hosts->by_address, etc_hosts_item_by_address_free);
hosts->by_name = hashmap_free_with_destructor(hosts->by_name, etc_hosts_item_by_name_free);
hosts->no_address = set_free_free(hosts->no_address);
}
_cleanup_free_ char *address_str = NULL;
struct in_addr_data address = {};
bool found = false;
- EtcHostsItem *item;
+ EtcHostsItemByAddress *item;
int r;
assert(hosts);
if (r < 0)
return log_oom();
- item = new(EtcHostsItem, 1);
+ item = new(EtcHostsItemByAddress, 1);
if (!item)
return log_oom();
- *item = (EtcHostsItem) {
+ *item = (EtcHostsItemByAddress) {
.address = address,
};
},
};
- EtcHostsItem *item;
+ EtcHostsItemByAddress *item;
assert(hosts);
}
assert_se(hashmap_remove(hosts->by_address, local_in_addrs + j) == item);
- etc_hosts_item_free(item);
+ etc_hosts_item_by_address_free(item);
}
}
r = dns_name_address(name, &k.family, &k.address);
if (r > 0) {
- EtcHostsItem *item;
+ EtcHostsItemByAddress *item;
DnsResourceKey *found_ptr = NULL;
item = hashmap_get(m->etc_hosts.by_address, &k);