diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-07-31 10:01:46 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-08-01 12:38:34 +0200 |
commit | 37b7cc8d9a111c40767e2124fbdc368cc8da5c1c (patch) | |
tree | ed74791e33d47a7f2d3093d010d6c3c8d569d4c9 /src/resolve/resolved-manager.h | |
parent | 8d732e2f716a03de8c05c7d01919e2daa3624280 (diff) | |
download | systemd-37b7cc8d9a111c40767e2124fbdc368cc8da5c1c.tar.gz |
resolved: put /etc/hosts hashmaps in a structure and pass that around
This hides the details of juggling the two hashmaps from the callers a bit.
It also makes memory management a bit easier, because those two hashmaps share
some strings, so we can only free them together.
etc_hosts_parse() is made responsible to free the half-filled data structures
on error, which makes the caller a bit simpler.
No functional change. A refactoring to prepare for later changes.
Diffstat (limited to 'src/resolve/resolved-manager.h')
-rw-r--r-- | src/resolve/resolved-manager.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h index 798040378e..c9cf2f0ee6 100644 --- a/src/resolve/resolved-manager.h +++ b/src/resolve/resolved-manager.h @@ -23,6 +23,11 @@ typedef struct Manager Manager; #define MANAGER_SEARCH_DOMAINS_MAX 32 #define MANAGER_DNS_SERVERS_MAX 32 +typedef struct EtcHosts { + Hashmap *by_address; + Hashmap *by_name; +} EtcHosts; + struct Manager { sd_event *event; @@ -114,8 +119,7 @@ struct Manager { unsigned n_dnssec_verdict[_DNSSEC_VERDICT_MAX]; /* Data from /etc/hosts */ - Hashmap* etc_hosts_by_address; - Hashmap* etc_hosts_by_name; + EtcHosts etc_hosts; usec_t etc_hosts_last, etc_hosts_mtime; bool read_etc_hosts; |