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

[libvirt PATCH 07/14] Do not check whether unsigned variables are negative



Signed-off-by: Ján Tomko <jtomko redhat com>
---
 src/openvz/openvz_driver.c | 2 +-
 src/vbox/vbox_common.c     | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 71e270ea09..74d87b1085 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1215,7 +1215,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
         return -1;
 
-    if (nvcpus <= 0) {
+    if (nvcpus == 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Number of vCPUs should be >= 1"));
         goto cleanup;
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 2783827012..b9b72e2e02 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2111,7 +2111,7 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIID *iid
                 VBOX_UTF16_TO_UTF8(valueDisplayUtf16, &valueDisplayUtf8);
                 VBOX_UTF16_FREE(valueDisplayUtf16);
 
-                if (strlen(valueDisplayUtf8) <= 0)
+                if (strlen(valueDisplayUtf8) == 0)
                     VBOX_UTF8_FREE(valueDisplayUtf8);
             }
 
@@ -2990,7 +2990,7 @@ vboxHostDeviceGetXMLDesc(vboxDriverPtr data, virDomainDefPtr def, IMachine *mach
     gVBoxAPI.UArray.vboxArrayGet(&deviceFilters, USBCommon,
                                  gVBoxAPI.UArray.handleUSBGetDeviceFilters(USBCommon));
 
-    if (deviceFilters.count <= 0)
+    if (deviceFilters.count == 0)
         goto release_filters;
 
     /* check if the filters are active and then only
@@ -3612,9 +3612,8 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine
     gVBoxAPI.UArray.vboxArrayGet(&sharedFolders, machine,
                                  gVBoxAPI.UArray.handleMachineGetSharedFolders(machine));
 
-    if (sharedFolders.count <= 0) {
-        if (sharedFolders.count == 0)
-            ret = 0;
+    if (sharedFolders.count == 0) {
+        ret = 0;
         goto cleanup;
     }
 
-- 
2.26.2


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