qemu-trivial
[Top][All Lists]
Advanced

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

Re: [PATCH] iothread: Simplify expression in qemu_in_iothread()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] iothread: Simplify expression in qemu_in_iothread()
Date: Thu, 8 Feb 2024 11:48:01 +0100
User-agent: Mozilla Thunderbird

On 8/2/24 11:16, Kevin Wolf wrote:
'a == b ? false : true' is a rather convoluted way of writing 'a != b'.
Use the more obvious way to write it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
  iothread.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/iothread.c b/iothread.c
index 6c1fc8c856..e1e9e04736 100644
--- a/iothread.c
+++ b/iothread.c
@@ -404,6 +404,5 @@ IOThread *iothread_by_id(const char *id)
bool qemu_in_iothread(void)
  {
-    return qemu_get_current_aio_context() == qemu_get_aio_context() ?
-                    false : true;
+    return qemu_get_current_aio_context() != qemu_get_aio_context();
  }

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

BTW using the same pattern:

-- >8 --
diff --git a/hw/nvram/xlnx-zynqmp-efuse.c b/hw/nvram/xlnx-zynqmp-efuse.c
index ec98456e5d..d074762a25 100644
--- a/hw/nvram/xlnx-zynqmp-efuse.c
+++ b/hw/nvram/xlnx-zynqmp-efuse.c
@@ -582,7 +582,7 @@ static uint64_t zynqmp_efuse_cache_load_prew(RegisterInfo *reg,

 static uint64_t zynqmp_efuse_wr_lock_prew(RegisterInfo *reg, uint64_t val)
 {
-    return val == 0xDF0D ? 0 : 1;
+    return val != 0xDF0D;
 }

diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c
index 301e61d0dd..bdd73bd181 100644
--- a/tests/tcg/aarch64/sysregs.c
+++ b/tests/tcg/aarch64/sysregs.c
@@ -183,5 +183,5 @@ int main(void)
         return 1;
     }

-    return should_fail_count == 6 ? 0 : 1;
+    return should_fail_count != 6;
 }
---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]