]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qdev: use g_strcmp0() instead of open-coding it
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 20 Nov 2019 13:42:01 +0000 (17:42 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 7 Jan 2020 13:24:29 +0000 (17:24 +0400)
Minor code simplification.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
hw/core/qdev.c

index 501228ba08f196afed9626a2afeac5cb9ded350f..aa3ccbf2ecdbabb18033a6ad3c8dc6bcd2df3d78 100644 (file)
@@ -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) {
             return ngl;
         }
     }