[PATCH 08/10] network: Rework networkGetDHCPLeases()

John Ferlan jferlan at redhat.com
Tue Jan 5 11:49:16 UTC 2021



On 12/18/20 10:09 AM, Michal Privoznik wrote:
> Firstly, bring variables that are used only within loops into
> their respective loops. Secondly, drop 'error' label which is
> redundant since we have @rv which holds the return value.
> Thirdly, fix indendation in one case, the rest is indented
> properly.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/network/bridge_driver.c | 47 +++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 25 deletions(-)
> 

[...]

> @@ -4145,7 +4146,7 @@ networkGetDHCPLeases(virNetworkPtr net,
>                  /* A lease without ip-address makes no sense */
>                  virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                                 _("found lease without ip-address"));
> -                goto error;
> +                goto cleanup;
>              }
>  
>              /* Unlike IPv4, IPv6 uses ':' instead of '.' as separator */
> @@ -4154,7 +4155,7 @@ networkGetDHCPLeases(virNetworkPtr net,
>  
>              /* Obtain prefix */
>              for (j = 0; j < def->nips; j++) {
> -                ipdef_tmp = &def->ips[j];
> +                virNetworkIPDefPtr ipdef_tmp = ipdef_tmp = &def->ips[j];

Coverity notes... Department of redundancy department

Simple/trivial fix for someone I'm sure

John

>  
>                  if (ipv6 && VIR_SOCKET_ADDR_IS_FAMILY(&ipdef_tmp->address,
>                                                        AF_INET6)) {
> @@ -4162,7 +4163,7 @@ networkGetDHCPLeases(virNetworkPtr net,

[...]




More information about the libvir-list mailing list