[PATCH v2 13/22] Remove unnecessary curly brackets in src/vbox/

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

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/vbox/vbox_MSCOMGlue.c     | 30 +++++++++----------------
 src/vbox/vbox_XPCOMCGlue.c    | 33 ++++++++++------------------
 src/vbox/vbox_common.c        | 51 +++++++++++++++----------------------------
 src/vbox/vbox_network.c       | 15 +++++--------
 src/vbox/vbox_snapshot_conf.c | 21 ++++++------------
 src/vbox/vbox_storage.c       | 30 +++++++++----------------
 src/vbox/vbox_tmpl.c          | 30 +++++++++----------------
 7 files changed, 70 insertions(+), 140 deletions(-)

diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index c1d3ec3..7208d73 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -385,9 +385,8 @@ vboxLookupRegistryValue(HKEY key, const char *keyName, const char *valueName)
         goto cleanup;
     }

-    if (value[length - 1] != '\0') {
+    if (value[length - 1] != '\0')
         value[length] = '\0';
-    }

  cleanup:
     return value;
@@ -421,17 +420,15 @@ vboxLookupVersionInRegistry(void)
      * the actual version number is in the VersionExt key then. */
     value = vboxLookupRegistryValue(key, keyName, "Version");

-    if (value == NULL) {
+    if (value == NULL)
         goto cleanup;
-    }

     if (STREQ(value, "%VER%")) {
         VIR_FREE(value);
         value = vboxLookupRegistryValue(key, keyName, "VersionExt");

-        if (value == NULL) {
+        if (value == NULL)
             goto cleanup;
-        }
     }

     if (virParseVersionString(value, &vboxVersion, false) < 0) {
@@ -478,13 +475,11 @@ vboxUtf16ToUtf8(const PRUnichar *pwszString, char **ppszString)
     int length = WideCharToMultiByte(CP_UTF8, 0, pwszString, -1, NULL, 0,
                                      NULL, NULL);

-    if (length < 1) {
+    if (length < 1)
         return -1;
-    }

-    if (VIR_ALLOC_N(*ppszString, length) < 0) {
+    if (VIR_ALLOC_N(*ppszString, length) < 0)
         return -1;
-    }

     return WideCharToMultiByte(CP_UTF8, 0, pwszString, -1, *ppszString,
                                length, NULL, NULL);
@@ -495,15 +490,13 @@ vboxUtf8ToUtf16(const char *pszString, PRUnichar **ppwszString)
 {
     int length = MultiByteToWideChar(CP_UTF8, 0, pszString, -1, NULL, 0);

-    if (length < 1) {
+    if (length < 1)
         return -1;
-    }

     *ppwszString = SysAllocStringLen(NULL, length);

-    if (*ppwszString == NULL) {
+    if (*ppwszString == NULL)
         return -1;
-    }

     return MultiByteToWideChar(CP_UTF8, 0, pszString, -1, *ppwszString, length);
 }
@@ -668,9 +661,8 @@ vboxGetFunctions(unsigned int version)
 int
 VBoxCGlueInit(unsigned int *version)
 {
-    if (vboxLookupVersionInRegistry() < 0) {
+    if (vboxLookupVersionInRegistry() < 0)
         return -1;
-    }

     *version = vboxGetVersion();
     g_pfnGetFunctions = vboxGetFunctions;
@@ -708,9 +700,8 @@ vboxArrayGetHelper(vboxArray *array, HRESULT hrc, SAFEARRAY *safeArray)
     array->count = 0;
     array->handle = NULL;

-    if (FAILED(hrc)) {
+    if (FAILED(hrc))
         return hrc;
-    }

     hrc = SafeArrayAccessData(safeArray, (void **)&items);

@@ -781,9 +772,8 @@ vboxArrayGetWithUintArg(vboxArray *array, void *self, void *getter, PRUint32 arg
 void
 vboxArrayRelease(vboxArray *array)
 {
-    if (array->handle == NULL) {
+    if (array->handle == NULL)
         return;
-    }

     SafeArrayUnaccessData(array->handle);
     SafeArrayDestroy(array->handle);
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index aaa7c60..944eb95 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -99,9 +99,8 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing,
             return -1;

         if (!virFileExists(name)) {
-            if (!ignoreMissing) {
+            if (!ignoreMissing)
                 VIR_ERROR(_("Library '%s' doesn't exist"), name);
-            }

             VIR_FREE(name);
             return -1;
@@ -130,9 +129,8 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing,
          * FIXME: Don't warn in this case as it currently breaks make check
          *        on systems without VirtualBox.
          */
-        if (dir != NULL) {
+        if (dir != NULL)
             VIR_WARN("Could not dlopen '%s': %s", name, dlerror());
-        }

         goto cleanup;
     }
@@ -206,29 +204,25 @@ VBoxCGlueInit(unsigned int *version)

     /* If the user specifies the location, try only that. */
     if (home != NULL) {
-        if (tryLoadOne(home, false, false, version) < 0) {
+        if (tryLoadOne(home, false, false, version) < 0)
             return -1;
-        }
     }

     /* Try the additionally configured location. */
     if (VBOX_XPCOMC_DIR[0] != '\0') {
-        if (tryLoadOne(VBOX_XPCOMC_DIR, true, true, version) >= 0) {
+        if (tryLoadOne(VBOX_XPCOMC_DIR, true, true, version) >= 0)
             return 0;
-        }
     }

     /* Try the known locations. */
     for (i = 0; i < ARRAY_CARDINALITY(knownDirs); ++i) {
-        if (tryLoadOne(knownDirs[i], true, true, version) >= 0) {
+        if (tryLoadOne(knownDirs[i], true, true, version) >= 0)
             return 0;
-        }
     }

     /* Finally try the dynamic linker search path. */
-    if (tryLoadOne(NULL, false, true, version) >= 0) {
+    if (tryLoadOne(NULL, false, true, version) >= 0)
         return 0;
-    }

     /* No luck, return failure. */
     return -1;
@@ -271,9 +265,8 @@ vboxArrayGetHelper(vboxArray *array, nsresult nsrc, void **items, PRUint32 count
     array->items = NULL;
     array->count = 0;

-    if (NS_FAILED(nsrc)) {
+    if (NS_FAILED(nsrc))
         return nsrc;
-    }

     array->items = items;
     array->count = count;
@@ -338,16 +331,14 @@ vboxArrayRelease(vboxArray *array)
     size_t i;
     nsISupports *supports;

-    if (array->items == NULL) {
+    if (array->items == NULL)
         return;
-    }

     for (i = 0; i < array->count; ++i) {
         supports = array->items[i];

-        if (supports != NULL) {
+        if (supports != NULL)
             supports->vtbl->Release(supports);
-        }
     }

     pVBoxFuncs_v2_2->pfnComUnallocMem(array->items);
@@ -365,16 +356,14 @@ vboxArrayUnalloc(vboxArray *array)
     size_t i;
     void *item;

-    if (array->items == NULL) {
+    if (array->items == NULL)
         return;
-    }

     for (i = 0; i < array->count; ++i) {
         item = array->items[i];

-        if (item != NULL) {
+        if (item != NULL)
             pVBoxFuncs_v2_2->pfnComUnallocMem(item);
-        }
     }

     pVBoxFuncs_v2_2->pfnComUnallocMem(array->items);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index cd5b478..bffec82 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -955,9 +955,8 @@ vboxSetBootDeviceOrder(virDomainDefPtr def, vboxGlobalData *data,
     }

     /* Clear the defaults first */
-    for (i = 0; i < maxBootPosition; i++) {
+    for (i = 0; i < maxBootPosition; i++)
         gVBoxAPI.UIMachine.SetBootOrder(machine, i+1, DeviceType_Null);
-    }

     for (i = 0; (i < def->os.nBootDevs) && (i < maxBootPosition); i++) {
         PRUint32 device = DeviceType_Null;
@@ -2115,9 +2114,8 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIIDUnion
             }
         }

-        if (STREQ(valueTypeUtf8, "vrdp")) {
+        if (STREQ(valueTypeUtf8, "vrdp"))
             vrdpPresent = 1;
-        }

         if (!vrdpPresent && !sdlPresent && !guiPresent) {
             /* if nothing is selected it means either the machine xml
@@ -2159,9 +2157,8 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIIDUnion
         VBOX_UTF8_TO_UTF16("sdl", &sessionType);
     }

-    if (vrdpPresent) {
+    if (vrdpPresent)
         VBOX_UTF8_TO_UTF16("vrdp", &sessionType);
-    }

     rc = gVBoxAPI.UIMachine.LaunchVMProcess(data, machine, iid,
                                             sessionType, env,
@@ -2995,9 +2992,8 @@ vboxHostDeviceGetXMLDesc(vboxGlobalData *data, virDomainDefPtr def, IMachine *ma
         IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];

         gVBoxAPI.UIUSBDeviceFilter.GetActive(deviceFilter, &active);
-        if (active) {
+        if (active)
             def->nhostdevs++;
-        }
     }

     if (def->nhostdevs == 0)
@@ -3222,9 +3218,8 @@ vboxDumpIDEHDDsNew(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)

     /* cleanup on error */
     if (error) {
-        for (i = 0; i < def->ndisks; i++) {
+        for (i = 0; i < def->ndisks; i++)
             VIR_FREE(def->disks[i]);
-        }
         VIR_FREE(def->disks);
         def->ndisks = 0;
     }
@@ -3393,14 +3388,12 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
                 }

                 gVBoxAPI.UIVRDxServer.GetAllowMultiConnection(VRDxServer, &allowMultiConnection);
-                if (allowMultiConnection) {
+                if (allowMultiConnection)
                     def->graphics[def->ngraphics]->data.rdp.multiUser = true;
-                }

                 gVBoxAPI.UIVRDxServer.GetReuseSingleConnection(VRDxServer, &reuseSingleConnection);
-                if (reuseSingleConnection) {
+                if (reuseSingleConnection)
                     def->graphics[def->ngraphics]->data.rdp.replaceUser = true;
-                }

                 def->ngraphics++;
             } else {
@@ -3488,9 +3481,8 @@ vboxDumpNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, PR
             PRBool enabled = PR_FALSE;

             gVBoxAPI.UINetworkAdapter.GetEnabled(adapter, &enabled);
-            if (enabled) {
+            if (enabled)
                 def->nnets++;
-            }

             VBOX_RELEASE(adapter);
         }
@@ -3498,9 +3490,8 @@ vboxDumpNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, PR

     /* Allocate memory for the networkcards which are enabled */
     if ((def->nnets > 0) && (VIR_ALLOC_N(def->nets, def->nnets) >= 0)) {
-        for (i = 0; i < def->nnets; i++) {
+        for (i = 0; i < def->nnets; i++)
             ignore_value(VIR_ALLOC(def->nets[i]));
-        }
     }

     /* Now get the details about the network cards here */
@@ -3669,9 +3660,8 @@ vboxDumpSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, PRU
             PRBool enabled = PR_FALSE;

             gVBoxAPI.UISerialPort.GetEnabled(serialPort, &enabled);
-            if (enabled) {
+            if (enabled)
                 def->nserials++;
-            }

             VBOX_RELEASE(serialPort);
         }
@@ -3679,9 +3669,8 @@ vboxDumpSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, PRU

     /* Allocate memory for the serial ports which are enabled */
     if ((def->nserials > 0) && (VIR_ALLOC_N(def->serials, def->nserials) >= 0)) {
-        for (i = 0; i < def->nserials; i++) {
+        for (i = 0; i < def->nserials; i++)
             ignore_value(VIR_ALLOC(def->serials[i]));
-        }
     }

     /* Now get the details about the serial ports here */
@@ -3759,9 +3748,8 @@ vboxDumpParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, P
             PRBool enabled = PR_FALSE;

             gVBoxAPI.UIParallelPort.GetEnabled(parallelPort, &enabled);
-            if (enabled) {
+            if (enabled)
                 def->nparallels++;
-            }

             VBOX_RELEASE(parallelPort);
         }
@@ -3769,9 +3757,8 @@ vboxDumpParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine, P

     /* Allocate memory for the parallel ports which are enabled */
     if ((def->nparallels > 0) && (VIR_ALLOC_N(def->parallels, def->nparallels) >= 0)) {
-        for (i = 0; i < def->nparallels; i++) {
+        for (i = 0; i < def->nparallels; i++)
             ignore_value(VIR_ALLOC(def->parallels[i]));
-        }
     }

     /* Now get the details about the parallel ports here */
@@ -4078,9 +4065,8 @@ static int vboxConnectNumOfDefinedDomains(virConnectPtr conn)
             continue;

         gVBoxAPI.UIMachine.GetState(machine, &state);
-        if (gVBoxAPI.machineStateChecker.Inactive(state)) {
+        if (gVBoxAPI.machineStateChecker.Inactive(state))
             ret++;
-        }
     }

  cleanup:
@@ -5765,9 +5751,8 @@ static int vboxSnapshotGetReadWriteDisks(virDomainSnapshotDefPtr def,
     ret = 0;
  cleanup:
     if (ret < 0) {
-        for (i = 0; i < def->ndisks; i++) {
+        for (i = 0; i < def->ndisks; i++)
             VIR_FREE(def->disks[i].src);
-        }
         VIR_FREE(def->disks);
         def->ndisks = 0;
     }
@@ -6053,13 +6038,11 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
         def->dom->os.arch = virArchFromHost();
         gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
         def->dom->maxvcpus = def->dom->vcpus = CPUCount;
-        if (vboxSnapshotGetReadWriteDisks(def, snapshot) < 0) {
+        if (vboxSnapshotGetReadWriteDisks(def, snapshot) < 0)
             VIR_DEBUG("Could not get read write disks for snapshot");
-        }

-        if (vboxSnapshotGetReadOnlyDisks(snapshot, def) < 0) {
+        if (vboxSnapshotGetReadOnlyDisks(snapshot, def) < 0)
             VIR_DEBUG("Could not get Readonly disks for snapshot");
-        }
     }

     rc = gVBoxAPI.UISnapshot.GetDescription(snap, &str16);
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index 792e547..7472537 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -429,9 +429,8 @@ vboxSocketFormatAddrUtf16(vboxGlobalData *data, virSocketAddrPtr addr)

     utf8 = virSocketAddrFormat(addr);

-    if (utf8 == NULL) {
+    if (utf8 == NULL)
         return NULL;
-    }

     VBOX_UTF8_TO_UTF16(utf8, &utf16);
     VIR_FREE(utf8);
@@ -820,9 +819,8 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,

     VBOX_UTF16_TO_UTF8(utf16, &utf8);

-    if (virSocketAddrParse(addr, utf8, AF_UNSPEC) < 0) {
+    if (virSocketAddrParse(addr, utf8, AF_UNSPEC) < 0)
         goto cleanup;
-    }

     result = 0;

@@ -927,9 +925,8 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
             VBOX_UTF16_FREE(fromIPAddressUtf16);
             VBOX_UTF16_FREE(toIPAddressUtf16);

-            if (errorOccurred) {
+            if (errorOccurred)
                 goto cleanup;
-            }
         } else {
             ipdef->nranges = 0;
         }
@@ -957,9 +954,8 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
                 VBOX_UTF16_FREE(macAddressUtf16);
                 VBOX_UTF16_FREE(ipAddressUtf16);

-                if (errorOccurred) {
+                if (errorOccurred)
                     goto cleanup;
-                }
             }
         } else {
             ipdef->nhosts = 0;
@@ -982,9 +978,8 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
         VBOX_UTF16_FREE(networkMaskUtf16);
         VBOX_UTF16_FREE(ipAddressUtf16);

-        if (errorOccurred) {
+        if (errorOccurred)
             goto cleanup;
-        }
     }

     DEBUGIID("Network UUID", &vboxnet0IID);
diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c
index 7af1231..57df1fd 100644
--- a/src/vbox/vbox_snapshot_conf.c
+++ b/src/vbox/vbox_snapshot_conf.c
@@ -226,9 +226,8 @@ virVBoxSnapshotConfRetrieveSnapshot(xmlNodePtr snapshotNode,

     xPathContext->node = snapshotNode;
     descriptionNode = virXPathNode("./vbox:Description", xPathContext);
-    if (descriptionNode != NULL) {
+    if (descriptionNode != NULL)
         snapshot->description = virXMLNodeToString(descriptionNode->doc, descriptionNode);
-    }

     hardwareNode = virXPathNode("./vbox:Hardware", xPathContext);
     if (hardwareNode == NULL) {
@@ -447,9 +446,8 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node,
         for (i = 0; i < snapshot->nchildren; i++) {
             xmlNodePtr child = xmlNewNode(NULL, BAD_CAST "Snapshot");
             xmlAddChild(snapshotsNode, child);
-            if (virVBoxSnapshotConfSerializeSnapshot(child, snapshot->children[i]) < 0) {
+            if (virVBoxSnapshotConfSerializeSnapshot(child, snapshot->children[i]) < 0)
                 goto cleanup;
-            }
         }
     }
     result = 0;
@@ -850,9 +848,8 @@ virVBoxSnapshotConfAddHardDiskToMediaRegistry(virVBoxSnapshotConfHardDiskPtr har
         goto cleanup;

     parentDisk->children[parentDisk->nchildren - 1] = hardDisk;
-    if (hardDisk->parent == NULL) {
+    if (hardDisk->parent == NULL)
         hardDisk->parent = parentDisk;
-    }
     ret = 0;

  cleanup:
@@ -915,9 +912,8 @@ virVBoxSnapshotConfRemoveSnapshot(virVBoxSnapshotConfMachinePtr machine,
     parentSnapshot = snapshot->parent;

     snapshot->parent = NULL;
-    while (i < parentSnapshot->nchildren && parentSnapshot->children[i] != snapshot) {
+    while (i < parentSnapshot->nchildren && parentSnapshot->children[i] != snapshot)
         ++i;
-    }
     if (VIR_DELETE_ELEMENT(parentSnapshot->children, i, parentSnapshot->nchildren) < 0)
         goto cleanup;

@@ -975,9 +971,8 @@ virVBoxSnapshotConfRemoveHardDisk(virVBoxSnapshotConfMediaRegistryPtr mediaRegis

     parentHardDisk = hardDisk->parent;
     i = 0;
-    while (i < parentHardDisk->nchildren && parentHardDisk->children[i] != hardDisk) {
+    while (i < parentHardDisk->nchildren && parentHardDisk->children[i] != hardDisk)
         ++i;
-    }
     hardDisk->parent = NULL;
     if (VIR_DELETE_ELEMENT(parentHardDisk->children, i, parentHardDisk->nchildren) < 0)
         goto cleanup;
@@ -1320,9 +1315,8 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
         xmlNodePtr node = nodes[i];
         xPathContext->node = node;
         xmlNodePtr sourceNode = virXPathNode("./source", xPathContext);
-        if (sourceNode) {
+        if (sourceNode)
             ret[i] = virXMLPropString(sourceNode, "file");
-        }
     }
     result = 0;

@@ -1382,9 +1376,8 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath,
         xmlNodePtr node = nodes[i];
         xPathContext->node = node;
         xmlNodePtr sourceNode = virXPathNode("./source", xPathContext);
-        if (sourceNode) {
+        if (sourceNode)
             ret[i] = virXMLPropString(sourceNode, "file");
-        }
     }
     result = 0;

diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index 0cf7a33..194484c 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -120,9 +120,8 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
     size_t i;
     int ret = -1;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
                                       gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
@@ -162,9 +161,8 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
     size_t i;
     int ret = -1;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
                                       gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
@@ -218,9 +216,8 @@ vboxStorageVolLookupByName(virStoragePoolPtr pool, const char *name)
     size_t i;
     virStorageVolPtr ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     if (!name)
         return ret;
@@ -296,9 +293,8 @@ vboxStorageVolLookupByKey(virConnectPtr conn, const char *key)
     nsresult rc;
     virStorageVolPtr ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     VBOX_IID_INITIALIZE(&hddIID);
     if (!key)
@@ -366,9 +362,8 @@ vboxStorageVolLookupByPath(virConnectPtr conn, const char *path)
     nsresult rc;
     virStorageVolPtr ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     VBOX_IID_INITIALIZE(&hddIID);

@@ -449,9 +444,8 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
     resultCodeUnion resultCode;
     virStorageVolPtr ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     virCheckFlags(0, NULL);

@@ -553,9 +547,8 @@ static int vboxStorageVolDelete(virStorageVolPtr vol, unsigned int flags)
     vboxIIDUnion hddIID;
     int ret = -1;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     VBOX_IID_INITIALIZE(&hddIID);
     virCheckFlags(0, -1);
@@ -707,9 +700,8 @@ static int vboxStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info
     nsresult rc;
     int ret = -1;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     if (!info)
         return ret;
@@ -767,9 +759,8 @@ static char *vboxStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags)
     nsresult rc;
     char *ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     virCheckFlags(0, NULL);

@@ -856,9 +847,8 @@ static char *vboxStorageVolGetPath(virStorageVolPtr vol)
     nsresult rc;
     char *ret = NULL;

-    if (!data->vboxObj) {
+    if (!data->vboxObj)
         return ret;
-    }

     if (virUUIDParse(vol->key, uuid) < 0) {
         virReportError(VIR_ERR_INVALID_ARG,
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index b2e9ef4..de8744d 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -251,9 +251,8 @@ static void nsIDtoChar(unsigned char *uuid, const nsID *iid)
     uuidstrdst[16] = uuidstrsrc[14];
     uuidstrdst[17] = uuidstrsrc[15];

-    for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
+    for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++)
         uuidstrdst[i] = uuidstrsrc[i];
-    }

     uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0';
     ignore_value(virUUIDParse(uuidstrdst, uuid));
@@ -291,9 +290,8 @@ static void nsIDFromChar(nsID *iid, const unsigned char *uuid)
     uuidstrdst[16] = uuidstrsrc[14];
     uuidstrdst[17] = uuidstrsrc[15];

-    for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
+    for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++)
         uuidstrdst[i] = uuidstrsrc[i];
-    }

     uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0';
     ignore_value(virUUIDParse(uuidstrdst, uuidinterim));
@@ -399,13 +397,11 @@ typedef struct _vboxIID_v2_x vboxIID_v2_x;
 static void
 vboxIIDUnalloc_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid)
 {
-    if (iid->value == NULL) {
+    if (iid->value == NULL)
         return;
-    }

-    if (iid->value != &iid->backing) {
+    if (iid->value != &iid->backing)
         data->pFuncs->pfnComUnallocMem(iid->value);
-    }

     iid->value = NULL;
 }
@@ -500,9 +496,8 @@ typedef struct _vboxIID_v3_x vboxIID_v3_x;
 static void
 vboxIIDUnalloc_v3_x(vboxGlobalData *data, vboxIID_v3_x *iid)
 {
-    if (iid->value != NULL && iid->owner) {
+    if (iid->value != NULL && iid->owner)
         data->pFuncs->pfnUtf16Free(iid->value);
-    }

     iid->value = NULL;
     iid->owner = true;
@@ -1770,9 +1765,8 @@ vboxConnectDomainEventRegister(virConnectPtr conn,
         data->vboxCallback = vboxAllocCallbackObj();
         if (data->vboxCallback != NULL) {
             rc = data->vboxObj->vtbl->RegisterCallback(data->vboxObj, data->vboxCallback);
-            if (NS_SUCCEEDED(rc)) {
+            if (NS_SUCCEEDED(rc))
                 vboxRet = 0;
-            }
         }
     } else {
         vboxRet = 0;
@@ -1809,9 +1803,8 @@ vboxConnectDomainEventRegister(virConnectPtr conn,
     if (ret >= 0) {
         return 0;
     } else {
-        if (data->vboxObj && data->vboxCallback) {
+        if (data->vboxObj && data->vboxCallback)
             data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback);
-        }
         return -1;
     }
 }
@@ -1876,9 +1869,8 @@ static int vboxConnectDomainEventRegisterAny(virConnectPtr conn,
         data->vboxCallback = vboxAllocCallbackObj();
         if (data->vboxCallback != NULL) {
             rc = data->vboxObj->vtbl->RegisterCallback(data->vboxObj, data->vboxCallback);
-            if (NS_SUCCEEDED(rc)) {
+            if (NS_SUCCEEDED(rc))
                 vboxRet = 0;
-            }
         }
     } else {
         vboxRet = 0;
@@ -1917,9 +1909,8 @@ static int vboxConnectDomainEventRegisterAny(virConnectPtr conn,
     if (ret >= 0) {
         return ret;
     } else {
-        if (data->vboxObj && data->vboxCallback) {
+        if (data->vboxObj && data->vboxCallback)
             data->vboxObj->vtbl->UnregisterCallback(data->vboxObj, data->vboxCallback);
-        }
         return -1;
     }
 }
@@ -2350,9 +2341,8 @@ _attachDVD(vboxGlobalData *data, IMachine *machine, const char *src)
     VBOX_UTF8_TO_UTF16(src, &dvdfileUtf16);

     data->vboxObj->vtbl->FindDVDImage(data->vboxObj, dvdfileUtf16, &dvdImage);
-    if (!dvdImage) {
+    if (!dvdImage)
         data->vboxObj->vtbl->OpenDVDImage(data->vboxObj, dvdfileUtf16, dvdemptyuuid.value, &dvdImage);
-    }

     if (!dvdImage)
         goto cleanup;
-- 
2.1.3

--
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]