[libvirt] [PATCH 18/32] Only return two values in udevGetStringProperty

Peter Krempa pkrempa at redhat.com
Mon Jun 6 12:08:03 UTC 2016


On Mon, Jun 06, 2016 at 11:01:55 +0200, Ján Tomko wrote:
> There is no need to differentiate between PROPERTY_FOUND
> and PROPERTY_MISSING - we can just look if the string is non-NULL.
> ---
>  src/node_device/node_device_udev.c | 87 ++++++++++++++++----------------------
>  1 file changed, 36 insertions(+), 51 deletions(-)
> 
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 35d0dc7..876fca1 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -90,9 +90,8 @@ static int udevGetStringProperty(struct udev_device *udev_device,
>  {
>      if (VIR_STRDUP(*value,
>                     udevGetDeviceProperty(udev_device, property_key)) < 0)
> -        return PROPERTY_ERROR;
> -
> -    return *value == NULL ? PROPERTY_MISSING : PROPERTY_FOUND;
> +        return -1;

Add a newline here.

> +    return 0;
>  }

ACK




More information about the libvir-list mailing list