1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-10 16:58:28 +03:00

resolve: rename EtcHostsItem -> EtcHostsItemByAddress

This commit is contained in:
Yu Watanabe 2022-12-07 22:41:17 +09:00
parent 0f7bdf3503
commit 133eedad2b
2 changed files with 10 additions and 10 deletions

View File

@ -18,7 +18,7 @@
/* Recheck /etc/hosts at most once every 2s */ /* Recheck /etc/hosts at most once every 2s */
#define ETC_HOSTS_RECHECK_USEC (2*USEC_PER_SEC) #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); strv_free(item->names);
free(item); free(item);
} }
@ -32,7 +32,7 @@ static void etc_hosts_item_by_name_free(EtcHostsItemByName *item) {
void etc_hosts_clear(EtcHosts *hosts) { void etc_hosts_clear(EtcHosts *hosts) {
assert(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->by_name = hashmap_free_with_destructor(hosts->by_name, etc_hosts_item_by_name_free);
hosts->no_address = set_free_free(hosts->no_address); hosts->no_address = set_free_free(hosts->no_address);
} }
@ -46,7 +46,7 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
_cleanup_free_ char *address_str = NULL; _cleanup_free_ char *address_str = NULL;
struct in_addr_data address = {}; struct in_addr_data address = {};
bool found = false; bool found = false;
EtcHostsItem *item; EtcHostsItemByAddress *item;
int r; int r;
assert(hosts); assert(hosts);
@ -81,11 +81,11 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
if (r < 0) if (r < 0)
return log_oom(); return log_oom();
item = new(EtcHostsItem, 1); item = new(EtcHostsItemByAddress, 1);
if (!item) if (!item)
return log_oom(); return log_oom();
*item = (EtcHostsItem) { *item = (EtcHostsItemByAddress) {
.address = address, .address = address,
}; };
@ -181,7 +181,7 @@ static void strip_localhost(EtcHosts *hosts) {
}, },
}; };
EtcHostsItem *item; EtcHostsItemByAddress *item;
assert(hosts); assert(hosts);
@ -248,7 +248,7 @@ static void strip_localhost(EtcHosts *hosts) {
} }
assert_se(hashmap_remove(hosts->by_address, local_in_addrs + j) == item); assert_se(hashmap_remove(hosts->by_address, local_in_addrs + j) == item);
etc_hosts_item_free(item); etc_hosts_item_by_address_free(item);
} }
} }
@ -367,7 +367,7 @@ int manager_etc_hosts_lookup(Manager *m, DnsQuestion* q, DnsAnswer **answer) {
r = dns_name_address(name, &k.family, &k.address); r = dns_name_address(name, &k.family, &k.address);
if (r > 0) { if (r > 0) {
EtcHostsItem *item; EtcHostsItemByAddress *item;
DnsResourceKey *found_ptr = NULL; DnsResourceKey *found_ptr = NULL;
item = hashmap_get(m->etc_hosts.by_address, &k); item = hashmap_get(m->etc_hosts.by_address, &k);

View File

@ -5,12 +5,12 @@
#include "resolved-dns-question.h" #include "resolved-dns-question.h"
#include "resolved-dns-answer.h" #include "resolved-dns-answer.h"
typedef struct EtcHostsItem { typedef struct EtcHostsItemByAddress {
struct in_addr_data address; struct in_addr_data address;
char **names; char **names;
size_t n_names; size_t n_names;
} EtcHostsItem; } EtcHostsItemByAddress;
typedef struct EtcHostsItemByName { typedef struct EtcHostsItemByName {
char *name; char *name;