[PATCH] esx: Simplify some esxVI_Boolean to bool

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

 



---
 src/esx/esx_driver.c |    6 ++----
 src/esx/esx_vi.c     |   34 +++++++++++++++-------------------
 src/esx/esx_vi.h     |   12 +++++-------
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 89240dc..4a9f474 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1511,8 +1511,7 @@ esxNumberOfDomains(virConnectPtr conn)
     }
 
     return esxVI_LookupNumberOfDomainsByPowerState
-             (priv->primary, esxVI_VirtualMachinePowerState_PoweredOn,
-              esxVI_Boolean_False);
+             (priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, false);
 }
 
 
@@ -2865,8 +2864,7 @@ esxNumberOfDefinedDomains(virConnectPtr conn)
     }
 
     return esxVI_LookupNumberOfDomainsByPowerState
-             (priv->primary, esxVI_VirtualMachinePowerState_PoweredOn,
-              esxVI_Boolean_True);
+             (priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, true);
 }
 
 
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 7f0b0a8..60bbb42 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -2016,7 +2016,7 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
 int
 esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
                                         esxVI_VirtualMachinePowerState powerState,
-                                        esxVI_Boolean inverse)
+                                        bool inverse)
 {
     bool success = false;
     esxVI_String *propertyNameList = NULL;
@@ -2044,10 +2044,8 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
                     goto cleanup;
                 }
 
-                if ((inverse != esxVI_Boolean_True &&
-                     powerState_ == powerState) ||
-                    (inverse == esxVI_Boolean_True &&
-                     powerState_ != powerState)) {
+                if ((!inverse && powerState_ == powerState) ||
+                    ( inverse && powerState_ != powerState)) {
                     count++;
                 }
             } else {
@@ -2488,7 +2486,7 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
     esxVI_String *completePropertyNameList = NULL;
     esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
     esxVI_TaskInfo *pendingTaskInfoList = NULL;
-    esxVI_Boolean blocked = esxVI_Boolean_Undefined;
+    bool blocked;
 
     if (esxVI_String_DeepCopyList(&completePropertyNameList,
                                   propertyNameList) < 0 ||
@@ -2884,8 +2882,7 @@ int
 esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
                                             const unsigned char *uuid,
                                             esxVI_Occurrence occurrence,
-                                            bool autoAnswer,
-                                            esxVI_Boolean *blocked)
+                                            bool autoAnswer, bool *blocked)
 {
     int result = -1;
     esxVI_ObjectContent *virtualMachine = NULL;
@@ -3553,8 +3550,8 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
 int
 esxVI_HandleVirtualMachineQuestion
   (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
-   esxVI_VirtualMachineQuestionInfo *questionInfo,
-   bool autoAnswer, esxVI_Boolean *blocked)
+   esxVI_VirtualMachineQuestionInfo *questionInfo, bool autoAnswer,
+   bool *blocked)
 {
     int result = -1;
     esxVI_ElementDescription *elementDescription = NULL;
@@ -3563,12 +3560,12 @@ esxVI_HandleVirtualMachineQuestion
     int answerIndex = 0;
     char *possibleAnswers = NULL;
 
-    if (blocked == NULL || *blocked != esxVI_Boolean_Undefined) {
+    if (blocked == NULL) {
         ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
         return -1;
     }
 
-    *blocked = esxVI_Boolean_False;
+    *blocked = false;
 
     if (questionInfo->choice->choiceInfo != NULL) {
         for (elementDescription = questionInfo->choice->choiceInfo;
@@ -3604,7 +3601,7 @@ esxVI_HandleVirtualMachineQuestion
                            "question is '%s', no possible answers"),
                          questionInfo->text);
 
-            *blocked = esxVI_Boolean_True;
+            *blocked = true;
             goto cleanup;
         } else if (answerChoice == NULL) {
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
@@ -3613,7 +3610,7 @@ esxVI_HandleVirtualMachineQuestion
                            "default answer is specified"), questionInfo->text,
                          possibleAnswers);
 
-            *blocked = esxVI_Boolean_True;
+            *blocked = true;
             goto cleanup;
         }
 
@@ -3639,7 +3636,7 @@ esxVI_HandleVirtualMachineQuestion
                          questionInfo->text);
         }
 
-        *blocked = esxVI_Boolean_True;
+        *blocked = true;
         goto cleanup;
     }
 
@@ -3677,7 +3674,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
     esxVI_PropertyChange *propertyChange = NULL;
     esxVI_AnyType *propertyValue = NULL;
     esxVI_TaskInfoState state = esxVI_TaskInfoState_Undefined;
-    esxVI_Boolean blocked = esxVI_Boolean_Undefined;
+    bool blocked;
     esxVI_TaskInfo *taskInfo = NULL;
 
     if (errorMessage == NULL || *errorMessage != NULL) {
@@ -3735,13 +3732,12 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
                 }
 
                 if (taskInfo->cancelable == esxVI_Boolean_True) {
-                    if (esxVI_CancelTask(ctx, task) < 0 &&
-                        blocked == esxVI_Boolean_True) {
+                    if (esxVI_CancelTask(ctx, task) < 0 && blocked) {
                         VIR_ERROR0(_("Cancelable task is blocked by an "
                                      "unanswered question but cancelation "
                                      "failed"));
                     }
-                } else if (blocked == esxVI_Boolean_True) {
+                } else if (blocked) {
                     VIR_ERROR0(_("Non-cancelable task is blocked by an "
                                  "unanswered question"));
                 }
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 9e37d86..8677ca0 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -351,7 +351,7 @@ int esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
 
 int esxVI_LookupNumberOfDomainsByPowerState
       (esxVI_Context *ctx, esxVI_VirtualMachinePowerState powerState,
-       esxVI_Boolean inverse);
+       bool inverse);
 
 int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
                                     int *id, char **name, unsigned char *uuid);
@@ -427,8 +427,7 @@ int esxVI_LookupPendingTaskInfoListByVirtualMachine
 int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
                                                 const unsigned char *uuid,
                                                 esxVI_Occurrence occurrence,
-                                                bool autoAnswer,
-                                                esxVI_Boolean *blocked);
+                                                bool autoAnswer, bool *blocked);
 
 int esxVI_LookupRootSnapshotTreeList
       (esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
@@ -460,10 +459,9 @@ int esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
                                        esxVI_AutoStartPowerInfo **powerInfoList);
 
 int esxVI_HandleVirtualMachineQuestion
-      (esxVI_Context *ctx,
-       esxVI_ManagedObjectReference *virtualMachine,
-       esxVI_VirtualMachineQuestionInfo *questionInfo,
-       bool autoAnswer, esxVI_Boolean *blocked);
+      (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
+       esxVI_VirtualMachineQuestionInfo *questionInfo, bool autoAnswer,
+       bool *blocked);
 
 int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
                                 esxVI_ManagedObjectReference *task,
-- 
1.7.0.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]