Re: [libvirt PATCH 10/11] vircommand: Remove NULL check in virCommandAddArg

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

 



On Thu, Jan 28, 2021 at 11:24:40 +0100, Tim Wiederhake wrote:
> `val` is declared `ATTRIBUTE_NONNULL`.

Please see:

https://gitlab.com/libvirt/libvirt/-/blob/master/src/internal.h#L127

ATTRIBUTE_NONNULL is unfortunately lead to wrong optimizations done by
gcc.

> Found by clang-tidy's "clang-diagnostic-tautological-pointer-compare"
> check.
> 
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  src/util/vircommand.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/src/util/vircommand.c b/src/util/vircommand.c
> index c3a98bbeac..223010c6aa 100644
> --- a/src/util/vircommand.c
> +++ b/src/util/vircommand.c
> @@ -1525,11 +1525,6 @@ virCommandAddArg(virCommandPtr cmd, const char *val)
>      if (!cmd || cmd->has_error)
>          return;
>  
> -    if (val == NULL) {
> -        cmd->has_error = EINVAL;
> -        return;
> -    }

So this might have actual value.




[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