summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-device
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-04-03 21:05:42 +0200
committerTom Gundersen <teg@jklm.no>2015-04-03 22:17:41 +0200
commitaa20f49a1c5816e6e7e97f2e2ba209be47f3c0a3 (patch)
tree0ef7cb7a09e624665f28abb98048b995bd975063 /src/libsystemd/sd-device
parent2fe29a46a3e16a787098f9fb410e1b756506fd52 (diff)
sd-device: get_properties_{nulstr,strv} - don't recreate the buffer unnecessarily
Diffstat (limited to 'src/libsystemd/sd-device')
-rw-r--r--src/libsystemd/sd-device/device-private.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index 81b0b6dde6..2add6bb0de 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -643,6 +643,9 @@ static int device_update_properties_bufs(sd_device *device) {
assert(device);
+ if (!device->properties_buf_outdated)
+ return 0;
+
FOREACH_DEVICE_PROPERTY(device, prop, val) {
size_t len = 0;
@@ -679,11 +682,9 @@ int device_get_properties_nulstr(sd_device *device, const uint8_t **nulstr, size
assert(nulstr);
assert(len);
- if (device->properties_buf_outdated) {
- r = device_update_properties_bufs(device);
- if (r < 0)
- return r;
- }
+ r = device_update_properties_bufs(device);
+ if (r < 0)
+ return r;
*nulstr = device->properties_nulstr;
*len = device->properties_nulstr_len;