lsblk: remove huge all-function if-condition

Let's make it more readable and easy to extend.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2022-04-22 11:16:20 +02:00
parent 24e896c140
commit d1574dae64

View file

@ -54,6 +54,8 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *dev
static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
{
struct udev_device *dev;
const char *data;
struct lsblk_devprop *prop;
if (ld->udev_requested)
return ld->properties;
@ -64,9 +66,10 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
goto done;
dev = udev_device_new_from_subsystem_sysname(udev, "block", ld->name);
if (dev) {
const char *data;
struct lsblk_devprop *prop;
if (!dev)
goto done;
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
if (ld->properties)
lsblk_device_free_properties(ld->properties);
@ -127,9 +130,6 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
}
udev_device_unref(dev);
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
}
done:
ld->udev_requested = 1;