mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 03:26:10 +00:00
LookupServer: Use HashMap::ensure() in load_etc_hosts()
This commit is contained in:
parent
1a71e20f93
commit
363c78e5d2
Notes:
sideshowbarker
2024-07-18 04:46:10 +09:00
Author: https://github.com/awesomekling
Commit: 363c78e5d2
1 changed files with 1 additions and 6 deletions
|
@ -91,12 +91,7 @@ void LookupServer::load_etc_hosts()
|
||||||
{
|
{
|
||||||
m_etc_hosts.clear();
|
m_etc_hosts.clear();
|
||||||
auto add_answer = [this](const DNSName& name, DNSRecordType record_type, String data) {
|
auto add_answer = [this](const DNSName& name, DNSRecordType record_type, String data) {
|
||||||
auto it = m_etc_hosts.find(name);
|
m_etc_hosts.ensure(name).empend(name, record_type, DNSRecordClass::IN, s_static_ttl, move(data), false);
|
||||||
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
auto file = Core::File::construct("/etc/hosts");
|
auto file = Core::File::construct("/etc/hosts");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue