This function is written just too complicated.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/libvirt-php.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 33b4c5d..54de2e3 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -8684,23 +8684,15 @@ PHP_FUNCTION(libvirt_storagepool_get_autostart)
 {
     php_libvirt_storagepool *pool = NULL;
     zval *zpool;
-    int flags = 0;
+    int autostart;
 
     GET_STORAGEPOOL_FROM_ARGS ("r", &zpool);
 
-    if (virStoragePoolGetAutostart (pool->pool, &flags) == 0)
-    {
-        if (flags == 0) {
-            RETURN_FALSE;
-        }
-        else {
-            RETURN_TRUE;
-        }
-    }
-    else
-    {
-        RETURN_FALSE;
-    }
+    if (virStoragePoolGetAutostart(pool->pool, &autostart) == 0 &&
+        autostart != 0)
+        RETURN_TRUE;
+
+    RETURN_FALSE;
 }
 
 /*
-- 
2.8.4

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

Reply via email to