mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LookupServer: Use HashMap::ensure() in load_etc_hosts()
This commit is contained in:
parent
1a71e20f93
commit
363c78e5d2
1 changed files with 1 additions and 6 deletions
|
@ -91,12 +91,7 @@ void LookupServer::load_etc_hosts()
|
|||
{
|
||||
m_etc_hosts.clear();
|
||||
auto add_answer = [this](const DNSName& name, DNSRecordType record_type, String data) {
|
||||
auto it = m_etc_hosts.find(name);
|
||||
if (it == m_etc_hosts.end()) {
|
||||
m_etc_hosts.set(name, {});
|
||||
it = m_etc_hosts.find(name);
|
||||
}
|
||||
it->value.empend(name, record_type, DNSRecordClass::IN, s_static_ttl, data, false);
|
||||
m_etc_hosts.ensure(name).empend(name, record_type, DNSRecordClass::IN, s_static_ttl, move(data), false);
|
||||
};
|
||||
|
||||
auto file = Core::File::construct("/etc/hosts");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue