]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-bus/bus-socket.c
Use initalization instead of explicit zeroing
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 24 Mar 2013 23:59:00 +0000 (19:59 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 Apr 2013 23:50:57 +0000 (19:50 -0400)
commitb92bea5d2a9481de69bb627a7b442a9f58fca43d
treed43f5e340014d5c3ce723eabb60cd74e3dd20a18
parent8c62ecf1a99ab4a3f69cb81be38715c504ef5723
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.
49 files changed:
src/core/dbus-execute.c
src/core/dbus.c
src/core/device.c
src/core/execute.c
src/core/job.c
src/core/locale-setup.c
src/core/loopback-setup.c
src/core/main.c
src/core/manager.c
src/core/mount.c
src/core/service.c
src/core/swap.c
src/core/umount.c
src/core/unit.c
src/cryptsetup/cryptsetup.c
src/hostname/hostnamectl.c
src/journal/journald-server.c
src/journal/journald-stream.c
src/journal/journald-syslog.c
src/libsystemd-bus/bus-socket.c
src/libsystemd-bus/sd-bus.c
src/locale/localectl.c
src/locale/localed.c
src/login/loginctl.c
src/login/logind-inhibit.c
src/login/logind-session.c
src/login/logind.c
src/login/pam-module.c
src/nspawn/nspawn.c
src/python-systemd/_reader.c
src/readahead/readahead-collect.c
src/remount-fs/remount-fs.c
src/reply-password/reply-password.c
src/shared/ask-password-api.c
src/shared/dbus-loop.c
src/shared/install.c
src/shared/log.c
src/shared/util.c
src/shared/utmp-wtmp.c
src/shared/virt.c
src/shutdownd/shutdownd.c
src/stdio-bridge/stdio-bridge.c
src/systemctl/systemctl.c
src/timedate/timedatectl.c
src/tmpfiles/tmpfiles.c
src/tty-ask-password-agent/tty-ask-password-agent.c
src/udev/udev-builtin-net_id.c
src/update-utmp/update-utmp.c
src/vconsole/vconsole-setup.c