From: "Michael S. Tsirkin" <mst@redhat.com>
To: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org,
raphael.s.norwitz@gmail.com
Subject: Re: [PATCH] Fix erroneous double negation in conditional
Date: Thu, 7 May 2020 16:34:58 -0400 [thread overview]
Message-ID: <20200507163220-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1588046669-24706-1-git-send-email-raphael.norwitz@nutanix.com>
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 <raphael.norwitz@nutanix.com>
> ---
> 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
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: qemu-trivial@nongnu.org, raphael.s.norwitz@gmail.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH] Fix erroneous double negation in conditional
Date: Thu, 7 May 2020 16:34:58 -0400 [thread overview]
Message-ID: <20200507163220-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1588046669-24706-1-git-send-email-raphael.norwitz@nutanix.com>
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 <raphael.norwitz@nutanix.com>
> ---
> 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
next parent reply other threads:[~2020-05-07 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1588046669-24706-1-git-send-email-raphael.norwitz@nutanix.com>
2020-05-07 20:34 ` Michael S. Tsirkin [this message]
2020-05-07 20:34 ` [PATCH] Fix erroneous double negation in conditional Michael S. Tsirkin
2020-05-07 20:06 Raphael Norwitz
2020-05-07 20:28 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200507163220-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=raphael.s.norwitz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.