Re: [libvirt PATCH 04/10] virNetworkEventDispatchDefaultFunc: Cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/8/21 1:17 PM, Tim Wiederhake wrote:
> Remove unnecessary label and goto.
> 
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  src/conf/network_event.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/src/conf/network_event.c b/src/conf/network_event.c
> index a47bf4dd3e..6335cbf711 100644
> --- a/src/conf/network_event.c
> +++ b/src/conf/network_event.c
> @@ -86,8 +86,8 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
>                                     virConnectObjectEventGenericCallback cb,
>                                     void *cbopaque)
>  {
> -    virNetworkPtr net = virGetNetwork(conn, event->meta.name, event->meta.uuid);
> -    if (!net)
> +    g_autoptr(virNetwork) net = NULL;
> +    if (!(net = virGetNetwork(conn, event->meta.name, event->meta.uuid)))

I think we can use this opportunity to put an empty line in between
declaration and code blocks.

>          return;
>  
>      switch ((virNetworkEventID)event->eventID) {
> @@ -100,16 +100,13 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
>                                                            networkLifecycleEvent->type,
>                                                            networkLifecycleEvent->detail,
>                                                            cbopaque);
> -            goto cleanup;
> +            return;
>          }
>  
>      case VIR_NETWORK_EVENT_ID_LAST:
>          break;
>      }
>      VIR_WARN("Unexpected event ID %d", event->eventID);
> -
> - cleanup:
> -    virObjectUnref(net);
>  }
>  
>  
> 

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux