summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-24 19:59:00 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-02 12:50:56 -0400
commit786cd8191bff8540133095f4ed48e9e889cdf5be (patch)
tree8c69032e9817e4a7de9c8bf02438cbdab074ac10 /src/udev
parent669bfbaeadb51100ff56147b801d403f70733bd7 (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/udev')
-rw-r--r--src/udev/udev-builtin-net_id.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index d6cb196d4c..2f38ef0969 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -395,7 +395,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
unsigned int i;
const char *devtype;
const char *prefix = "en";
- struct netnames names;
+ struct netnames names = {};
int err;
/* handle only ARPHRD_ETHER devices */
@@ -424,7 +424,6 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
prefix = "ww";
}
- zero(names);
err = names_mac(dev, &names);
if (err >= 0 && names.mac_valid) {
char str[IFNAMSIZ];