Skip to content

resolve: several cleanups of handing /etc/hosts - #9760

Merged
poettering merged 3 commits into
systemd:masterfrom
yuwata:resolve-etc-hosts-cleanup
Jul 31, 2018
Merged

poettering merged 3 commits into
systemd:masterfrom
yuwata:resolve-etc-hosts-cleanup

Conversation

@yuwata

@yuwata yuwata commented Jul 31, 2018

Copy link
Copy Markdown
Member

This slightly improve the performance of reading /etc/hosts about ~1%. Of course, it is not enough for #9718.

@yuwata yuwata added the resolve label Jul 31, 2018
Comment thread src/basic/in-addr-util.c
siphash24_compress(&a->address.in, sizeof(a->address.in), state);
else if (a->family == AF_INET6)
siphash24_compress(&a->address.in6, sizeof(a->address.in6), state);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add

else
        assert_not_reached("unexpected socket protocol");

or so...

Comment thread src/basic/in-addr-util.c
const struct in_addr_data *x = a, *y = b;

if (x->family != y->family)
return x->family - y->family;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's hope that sa_family_t is signed, because otherwise this is pretty ugly...

I usually prefer doing explicit comparisons here and returning -1, 0, 1...

@poettering
poettering merged commit 48e0e10 into systemd:master Jul 31, 2018
@yuwata
yuwata deleted the resolve-etc-hosts-cleanup branch July 31, 2018 08:56
@yuwata yuwata mentioned this pull request Jul 31, 2018
filbranden added a commit to filbranden/systemd that referenced this pull request Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants