[Spice-devel] [spice-gtk v1 1/5] win-usb-dev: Make usage of early return

Christophe Fergeau cfergeau at redhat.com
Tue Nov 15 10:44:16 UTC 2016


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Tue, Nov 15, 2016 at 12:26:51AM +0100, Victor Toso wrote:
> From: Victor Toso <me at victortoso.com>
> 
> No need for if else here.
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
>  src/win-usb-dev.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
> index 1cf9f21..a857b02 100644
> --- a/src/win-usb-dev.c
> +++ b/src/win-usb-dev.c
> @@ -108,12 +108,11 @@ GQuark g_udev_client_error_quark(void)
>  
>  GUdevClient *g_udev_client_new(const gchar* const *subsystems)
>  {
> -    if (!singleton) {
> -        singleton = g_initable_new(G_UDEV_TYPE_CLIENT, NULL, NULL, NULL);
> -        return singleton;
> -    } else {
> +    if (singleton != NULL)
>          return g_object_ref(singleton);
> -    }
> +
> +    singleton = g_initable_new(G_UDEV_TYPE_CLIENT, NULL, NULL, NULL);
> +    return singleton;
>  }
>  
>  
> -- 
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161115/ed6a76e5/attachment.sig>


More information about the Spice-devel mailing list