diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-24 19:59:00 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-06-02 12:50:56 -0400 |
commit | 786cd8191bff8540133095f4ed48e9e889cdf5be (patch) | |
tree | 8c69032e9817e4a7de9c8bf02438cbdab074ac10 /src/libudev/socket-util.h | |
parent | 669bfbaeadb51100ff56147b801d403f70733bd7 (diff) |
Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.
A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:
$ size build/.libs/systemd
text data bss dec hex filename
before 897737 107300 2560 1007597 f5fed build/.libs/systemd
after 897873 107300 2560 1007733 f6075 build/.libs/systemd
… actually less than 1‰.
A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert.
NOTE by Basile: the above analysis is for all systemd. This commit
is just a sliver of the commit for all of system and so we can't
expect size to be the same.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/socket-util.h')
0 files changed, 0 insertions, 0 deletions