diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-12-07 22:30:45 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-12-13 20:26:55 +0900 |
commit | 0f7bdf35037322e020066f22b7c18dacdb340c4b (patch) | |
tree | 6e72532f3cb4c87debb91085a4d26f6964c3c86d /src/resolve/resolved-etc-hosts.c | |
parent | 10b89c59dc789a4794b7a5be2b954d0dee7acbfa (diff) | |
download | systemd-0f7bdf35037322e020066f22b7c18dacdb340c4b.tar.gz |
resolve: rename etc_hosts_free() -> etc_hosts_clear()
Diffstat (limited to 'src/resolve/resolved-etc-hosts.c')
-rw-r--r-- | src/resolve/resolved-etc-hosts.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c index 8a58db4a21..5dff0d96ba 100644 --- a/src/resolve/resolved-etc-hosts.c +++ b/src/resolve/resolved-etc-hosts.c @@ -29,14 +29,16 @@ static void etc_hosts_item_by_name_free(EtcHostsItemByName *item) { free(item); } -void etc_hosts_free(EtcHosts *hosts) { +void etc_hosts_clear(EtcHosts *hosts) { + assert(hosts); + hosts->by_address = hashmap_free_with_destructor(hosts->by_address, etc_hosts_item_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); } void manager_etc_hosts_flush(Manager *m) { - etc_hosts_free(&m->etc_hosts); + etc_hosts_clear(&m->etc_hosts); m->etc_hosts_stat = (struct stat) {}; } @@ -251,7 +253,7 @@ static void strip_localhost(EtcHosts *hosts) { } int etc_hosts_parse(EtcHosts *hosts, FILE *f) { - _cleanup_(etc_hosts_free) EtcHosts t = {}; + _cleanup_(etc_hosts_clear) EtcHosts t = {}; unsigned nr = 0; int r; @@ -282,7 +284,7 @@ int etc_hosts_parse(EtcHosts *hosts, FILE *f) { strip_localhost(&t); - etc_hosts_free(hosts); + etc_hosts_clear(hosts); *hosts = t; t = (EtcHosts) {}; /* prevent cleanup */ return 0; |