[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix erroneous double negation in conditional
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH] Fix erroneous double negation in conditional |
Date: |
Thu, 7 May 2020 16:34:58 -0400 |
On Tue, Apr 28, 2020 at 12:04:29AM -0400, Raphael Norwitz wrote:
> In vhost_migration_log() there is the following check:
> if(!!enable == dev->log_enabled) {
> return 0;
> }
>
> The double negative “!!” is unnecessary and bad coding style.
It converts the value to bool.
> This
> change removes it.
>
> Signed-off-by: Raphael Norwitz <address@hidden>
> ---
> hw/virtio/vhost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index aff98a0..83be0c8 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -814,7 +814,7 @@ static int vhost_migration_log(MemoryListener *listener,
> int enable)
> struct vhost_dev *dev = container_of(listener, struct vhost_dev,
> memory_listener);
> int r;
> - if (!!enable == dev->log_enabled) {
> + if (enable == dev->log_enabled) {
> return 0;
> }
> if (!dev->started) {
> --
> 1.8.3.1
- Re: [PATCH] Fix erroneous double negation in conditional,
Michael S. Tsirkin <=