[PATCH v2 2/5] conf: remove unnecessary NULL checks

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

 



Just above in the function, we return from the function if either x or y
are NULL, so there's no need to re-check whether x or y are NULL.

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9ee9b44a5e..ad1d3ffea6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15365,20 +15365,16 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node)
     if (VIR_ALLOC(def) < 0)
         goto cleanup;
 
-    if (x) {
-        if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("cannot parse video x-resolution '%s'"), x);
-            goto cleanup;
-        }
+    if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("cannot parse video x-resolution '%s'"), x);
+        goto cleanup;
     }
 
-    if (y) {
-        if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("cannot parse video y-resolution '%s'"), y);
-            goto cleanup;
-        }
+    if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("cannot parse video y-resolution '%s'"), y);
+        goto cleanup;
     }
 
  cleanup:
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux