diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-17 11:30:04 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-17 11:35:04 +0200 |
commit | 7b9103a622683575192f35d1865794c8680f99c6 (patch) | |
tree | f615ef5f9497e94246dd41028ceeba67cb29c4a9 /src/libsystemd/sd-device | |
parent | sd-bus: voidify two calls to hashmap_iterate() (diff) | |
download | systemd-7b9103a622683575192f35d1865794c8680f99c6.tar.xz systemd-7b9103a622683575192f35d1865794c8680f99c6.zip |
sd-device: voidify and simplify calls to ordered_hashmap_iterate()
Coverity CID#1402356 and CID#1402335.
Diffstat (limited to 'src/libsystemd/sd-device')
-rw-r--r-- | src/libsystemd/sd-device/sd-device.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 617d6de667..c4a7f2f3d3 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1540,7 +1540,6 @@ int device_properties_prepare(sd_device *device) { _public_ const char *sd_device_get_property_first(sd_device *device, const char **_value) { const char *key; - const char *value; int r; assert_return(device, NULL); @@ -1552,16 +1551,12 @@ _public_ const char *sd_device_get_property_first(sd_device *device, const char device->properties_iterator_generation = device->properties_generation; device->properties_iterator = ITERATOR_FIRST; - ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)&value, (const void**)&key); - - if (_value) - *_value = value; + (void) ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)_value, (const void**)&key); return key; } _public_ const char *sd_device_get_property_next(sd_device *device, const char **_value) { const char *key; - const char *value; int r; assert_return(device, NULL); @@ -1573,10 +1568,7 @@ _public_ const char *sd_device_get_property_next(sd_device *device, const char * if (device->properties_iterator_generation != device->properties_generation) return NULL; - ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)&value, (const void**)&key); - - if (_value) - *_value = value; + (void) ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)_value, (const void**)&key); return key; } |