The same pattern is used in lots of other places.

Signed-off-by: Marcos Paulo de Souza <marcos.souza....@gmail.com>
---
 src/esx/esx_vi.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 43ff7ea048..25fbdc7e44 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -3014,16 +3014,10 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, 
const char *name,
         break;
     }
 
-    if (!(*virtualMachine)) {
-        if (occurrence == esxVI_Occurrence_OptionalItem) {
-            result = 0;
-
-            goto cleanup;
-        } else {
-            virReportError(VIR_ERR_NO_DOMAIN,
-                           _("Could not find domain with name '%s'"), name);
-            goto cleanup;
-        }
+    if (!(*virtualMachine) && occurrence != esxVI_Occurrence_OptionalItem) {
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("Could not find domain with name '%s'"), name);
+        goto cleanup;
     }
 
     result = 0;
-- 
2.17.1

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

Reply via email to