diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2008-10-25 15:51:19 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-26 02:11:56 +0100 |
commit | cd94c04c518fffbf7f2c173952d77414a5d6bb6b (patch) | |
tree | d8730d3d34b25d349fedff0a264dd5947d318122 /udev/udev-rules.c | |
parent | e25fa4faf5b4977cc90c87003a41107a920bbe4d (diff) |
udevd: avoid implicit memset in match_attr()
Initializing a char array to "" is equivalent to a memset()
call - which is exactly what it gets compiled to.
Fixing this one callsite reduced memset() _user_ cpu cycles
from 2-4% to 0.05% on the EeePC.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Diffstat (limited to 'udev/udev-rules.c')
-rw-r--r-- | udev/udev-rules.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4df9eb35c8..44b26906b4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1794,10 +1794,11 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct char attr[UTIL_PATH_SIZE]; const char *key_name = &rules->buf[cur->key.attr_off]; const char *key_value = &rules->buf[cur->key.value_off]; - char value[UTIL_NAME_SIZE] = ""; + char value[UTIL_NAME_SIZE]; size_t len; util_strlcpy(attr, key_name, sizeof(attr)); + util_strlcpy(value, "", sizeof(value)); util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); if (value[0] == '\0') { const char *val; |