qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 28/37] qdev: use g_strcmp0() instead of open-coding it


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 28/37] qdev: use g_strcmp0() instead of open-coding it
Date: Wed, 20 Nov 2019 17:25:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 11/20/19 4:24 PM, Marc-André Lureau wrote:
Minor code simplification.

Signed-off-by: Marc-André Lureau <address@hidden>
---
  hw/core/qdev.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index cf1ba28fe3..c79befc865 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -394,11 +394,8 @@ static NamedGPIOList *qdev_get_named_gpio_list(DeviceState 
*dev,
      NamedGPIOList *ngl;
QLIST_FOREACH(ngl, &dev->gpios, node) {
-        /* NULL is a valid and matchable name, otherwise do a normal
-         * strcmp match.
-         */
-        if ((!ngl->name && !name) ||
-                (name && ngl->name && strcmp(name, ngl->name) == 0)) {
+        /* NULL is a valid and matchable name. */
+        if (g_strcmp0(name, ngl->name) == 0) {

Cocci pattern?

              return ngl;
          }
      }


Reviewed-by: Philippe Mathieu-Daudé <address@hidden>




reply via email to

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