[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/7] misc: fix mixups of bool constants with int variables
|
From: |
Peter Maydell |
|
Subject: |
Re: [PATCH v2 2/7] misc: fix mixups of bool constants with int variables |
|
Date: |
Mon, 4 Jul 2022 16:38:25 +0100 |
On Mon, 4 Jul 2022 at 16:23, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> block/vhdx-log.c | 2 +-
> hw/xtensa/sim.c | 4 ++--
> nbd/client.c | 4 ++--
> target/i386/cpu-dump.c | 3 ++-
> ui/spice-display.c | 4 ++--
> 5 files changed, 9 insertions(+), 8 deletions(-)
> diff --git a/nbd/client.c b/nbd/client.c
> index 30d5383cb1..fee3959d24 100644
> --- a/nbd/client.c
> +++ b/nbd/client.c
> @@ -832,8 +832,8 @@ static int nbd_list_meta_contexts(QIOChannel *ioc,
> Error **errp)
> {
> int ret;
> - int seen_any = false;
> - int seen_qemu = false;
> + bool seen_any = false;
> + bool seen_qemu = false;
>
> if (nbd_send_meta_query(ioc, NBD_OPT_LIST_META_CONTEXT,
> info->name, NULL, errp) < 0) {
The code in this function does a bitwise OR into seen_qemu later --
bitwise OR into a bool also seems like bad style that something
is probably going to complain about. (I guess currently -Wbool-operation
doesn't care about it or else we don't enable that, but it might
in future.)
The other changes look OK.
-- PMM
- [PATCH v2 0/7] tests: introduce a tree-wide code style checking facility, Daniel P . Berrangé, 2022/07/04
- [PATCH v2 1/7] tests: introduce tree-wide code style checking, Daniel P . Berrangé, 2022/07/04
- [PATCH v2 3/7] tests/style: check for mixups of bool constants with int variables, Daniel P . Berrangé, 2022/07/04
- [PATCH v2 2/7] misc: fix mixups of bool constants with int variables, Daniel P . Berrangé, 2022/07/04
- Re: [PATCH v2 2/7] misc: fix mixups of bool constants with int variables,
Peter Maydell <=
- [PATCH v2 5/7] tests/style: check for commonly doubled up words, Daniel P . Berrangé, 2022/07/04
- [PATCH v2 4/7] misc: fix commonly doubled up words, Daniel P . Berrangé, 2022/07/04
- [PATCH v2 7/7] tests/style: check qemu/osdep.h is included in all .c files, Daniel P . Berrangé, 2022/07/04