[libvirt-php][PATCH 2/8] libvirt_storagepool_get_autostart: Rework

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

 



This function is written just too complicated.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 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@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]