[libvirt PATCH v2 1/2] nwfilter: Replace a redundant 'now' variable with a direct time(0) call

Peter Krempa pkrempa at redhat.com
Tue Aug 23 16:35:46 UTC 2022


On Tue, Aug 23, 2022 at 18:22:36 +0200, Erik Skultety wrote:
> In this very instance having a variable is pointless since there is
> only a single time(0) call in the whole function.
> 
> Signed-off-by: Erik Skultety <eskultet at redhat.com>
> ---
>  src/nwfilter/nwfilter_dhcpsnoop.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
> index a10a14cfc1..18812c0b20 100644
> --- a/src/nwfilter/nwfilter_dhcpsnoop.c
> +++ b/src/nwfilter/nwfilter_dhcpsnoop.c

[...]

> @@ -1746,7 +1744,7 @@ virNWFilterSnoopLeaseFileLoad(void)
>                               "line %d corrupt"), ln);
>              break;
>          }
> -        if (ipl.timeout && ipl.timeout < now)
> +        if (ipl.timeout && ipl.timeout < time(0))

'time()' takes a pointer, so the argument should be 'NULL' instead.

>              continue;
>          req = virNWFilterSnoopReqGetByIFKey(ifkey);
>          if (!req) {
> -- 
> 2.37.2
> 


More information about the libvir-list mailing list