[libvirt] [PATCH] Remove duplicate empty lines and correct indentation and style

Matthias Bolte matthias.bolte at googlemail.com
Thu Jul 7 07:24:15 UTC 2011


No functional change included.
---
 python/libvirt-override.c                 |    1 -
 src/conf/domain_conf.c                    |    1 -
 src/conf/interface_conf.c                 |    1 -
 src/conf/network_conf.c                   |    1 -
 src/conf/node_device_conf.c               |    4 -
 src/conf/storage_conf.c                   |    1 -
 src/interface/netcf_driver.c              |   16 ++----
 src/libxl/libxl_driver.c                  |    2 +-
 src/lxc/lxc_driver.c                      |    2 +-
 src/node_device/node_device_driver.c      |    2 -
 src/node_device/node_device_linux_sysfs.c |    2 -
 src/nwfilter/nwfilter_ebiptables_driver.c |    2 -
 src/openvz/openvz_driver.c                |   87 ++++++++++++++---------------
 src/qemu/qemu_capabilities.c              |    2 +-
 src/qemu/qemu_command.c                   |    2 +-
 src/qemu/qemu_driver.c                    |   10 +--
 src/qemu/qemu_process.c                   |    1 -
 src/rpc/virnetclient.c                    |    2 -
 src/rpc/virnetserverservice.c             |    2 -
 src/uml/uml_driver.c                      |    2 -
 src/xen/xen_driver.c                      |    1 -
 src/xen/xs_internal.c                     |   12 ++--
 src/xenxs/xen_xm.c                        |    1 -
 tests/virnetsockettest.c                  |    3 -
 24 files changed, 60 insertions(+), 100 deletions(-)

diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 2b88796..64d793d 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2572,7 +2572,6 @@ libvirt_virConnectDomainEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
         ret = 0;
     }
 
-
 cleanup:
     LIBVIRT_RELEASE_THREAD_STATE;
     return ret;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7bcdcaf..83930c1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9806,7 +9806,6 @@ char *virDomainDefFormat(virDomainDefPtr def,
         if (virDomainFSDefFormat(&buf, def->fss[n], flags) < 0)
             goto cleanup;
 
-
     for (n = 0 ; n < def->nnets ; n++)
         if (virDomainNetDefFormat(&buf, def->nets[n], flags) < 0)
             goto cleanup;
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 10377e7..99c3052 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1300,7 +1300,6 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
     interfaces->count++;
 
     return iface;
-
 }
 
 void virInterfaceRemove(virInterfaceObjListPtr interfaces,
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index ae479bf..3aeec7e 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1155,7 +1155,6 @@ int virNetworkSaveXML(const char *configDir,
 
  cleanup:
     VIR_FORCE_CLOSE(fd);
-
     VIR_FREE(configFile);
 
     return ret;
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index dde2921..1ea122e 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -746,11 +746,8 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
         }
 
         if (STREQ(type, "vport_ops")) {
-
             data->scsi_host.flags |= VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS;
-
         } else if (STREQ(type, "fc_host")) {
-
             xmlNodePtr orignode2;
 
             data->scsi_host.flags |= VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST;
@@ -775,7 +772,6 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
             }
 
             ctxt->node = orignode2;
-
         } else {
             virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("unknown SCSI host capability type '%s' for '%s'"),
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index f6f8be1..21d39a8 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1203,7 +1203,6 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
     virBufferAsprintf(buf,"      <group>%d</group>\n",
                       def->perms.gid);
 
-
     if (def->perms.label)
         virBufferAsprintf(buf,"      <label>%s</label>\n",
                           def->perms.label);
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index dd15c9d..5a549db 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -125,22 +125,19 @@ static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn,
 {
     struct interface_driver *driverState;
 
-    if (VIR_ALLOC(driverState) < 0)
-    {
+    if (VIR_ALLOC(driverState) < 0) {
         virReportOOMError();
         goto alloc_error;
     }
 
     /* initialize non-0 stuff in driverState */
-    if (virMutexInit(&driverState->lock) < 0)
-    {
+    if (virMutexInit(&driverState->lock) < 0) {
         /* what error to report? */
         goto mutex_error;
     }
 
     /* open netcf */
-    if (ncf_init(&driverState->netcf, NULL) != 0)
-    {
+    if (ncf_init(&driverState->netcf, NULL) != 0) {
         /* what error to report? */
         goto netcf_error;
     }
@@ -149,8 +146,7 @@ static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn,
     return VIR_DRV_OPEN_SUCCESS;
 
 netcf_error:
-    if (driverState->netcf)
-    {
+    if (driverState->netcf) {
         ncf_close(driverState->netcf);
     }
     virMutexDestroy (&driverState->lock);
@@ -162,9 +158,7 @@ alloc_error:
 
 static int interfaceCloseInterface(virConnectPtr conn)
 {
-
-    if (conn->interfacePrivateData != NULL)
-    {
+    if (conn->interfacePrivateData != NULL) {
         struct interface_driver *driver = conn->interfacePrivateData;
 
         /* close netcf instance */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index ade69d8..4926398 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2671,7 +2671,7 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
 
-   if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
+    if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
         goto cleanup;
 
     if (!(vm = virDomainAssignDef(driver->caps,
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ffcfe4d..2b1585b 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -412,7 +412,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
 
-   if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
+    if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
         goto cleanup;
 
     if ((def->nets != NULL) && !(driver->have_netns)) {
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 842f903..62ceee7 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -220,13 +220,11 @@ nodeDeviceLookupByWWN(virConnectPtr conn,
     nodeDeviceLock(driver);
 
     for (i = 0; i < devs->count; i++) {
-
         obj = devs->objs[i];
         virNodeDeviceObjLock(obj);
         cap = obj->def->caps;
 
         while (cap) {
-
             if (cap->type == VIR_NODE_DEV_CAP_SCSI_HOST) {
                 check_fc_host(&cap->data);
                 if (cap->data.scsi_host.flags &
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 34e4501..eab5158 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -270,13 +270,11 @@ static int get_sriov_function(const char *device_link,
               device_link);
 
     if (!virFileExists(device_link)) {
-
         VIR_DEBUG("SR IOV function link '%s' does not exist", device_link);
         /* Not an SR IOV device, not an error, either. */
         ret = SRIOV_NOT_FOUND;
 
         goto out;
-
     }
 
     device_path = canonicalize_file_name (device_link);
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index c9b60da..7321c2a 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -922,7 +922,6 @@ iptablesHandleIpHdr(virBufferPtr buf,
                           ipaddr);
 
         if (HAS_ENTRY_ITEM(&ipHdr->dataSrcIPTo)) {
-
             if (printDataType(vars,
                               ipaddr, sizeof(ipaddr),
                               &ipHdr->dataSrcIPTo))
@@ -1584,7 +1583,6 @@ _iptablesCreateRuleInstance(int directionIn,
     } else
         final = &buf;
 
-
     return ebiptablesAddRuleInst(res,
                                  virBufferContentAndReset(final),
                                  nwfilter->chainsuffix,
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index c13f346..d62b91f 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -177,18 +177,14 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
 
     if (vmdef->nfss == 1 &&
         vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE &&
-        vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_MOUNT)
-    {
+        vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_MOUNT) {
         openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
                     _("filesystem is not of type 'template' or 'mount'"));
         goto cleanup;
     }
 
-
     if (vmdef->nfss == 1 &&
-        vmdef->fss[0]->type == VIR_DOMAIN_FS_TYPE_MOUNT)
-    {
-
+        vmdef->fss[0]->type == VIR_DOMAIN_FS_TYPE_MOUNT) {
         if (virStrToLong_i(vmdef->name, NULL, 10, &vpsid) < 0) {
             openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
                         _("Could not convert domain name to VEID"));
@@ -206,9 +202,7 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
                         _("Could not set the source dir for the filesystem"));
             goto cleanup;
         }
-    }
-    else
-    {
+    } else {
         if (openvzDomainDefineCmd(prog, OPENVZ_MAX_ARG, vmdef) < 0) {
             VIR_ERROR(_("Error creating command for container"));
             goto cleanup;
@@ -222,9 +216,9 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
     ret = 0;
 
 cleanup:
-  VIR_FREE(confdir);
-  cmdExecFree(prog);
-  return ret;
+    VIR_FREE(confdir);
+    cmdExecFree(prog);
+    return ret;
 }
 
 
@@ -537,42 +531,43 @@ cleanup:
     return ret;
 }
 
-static int openvzDomainResume(virDomainPtr dom) {
-  struct openvz_driver *driver = dom->conn->privateData;
-  virDomainObjPtr vm;
-  const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINAL, "--resume", NULL};
-  int ret = -1;
-
-  openvzDriverLock(driver);
-  vm = virDomainFindByUUID(&driver->domains, dom->uuid);
-  openvzDriverUnlock(driver);
-
-  if (!vm) {
-      openvzError(VIR_ERR_NO_DOMAIN, "%s",
-                  _("no domain with matching uuid"));
-      goto cleanup;
-  }
-
-  if (!virDomainObjIsActive(vm)) {
-      openvzError(VIR_ERR_OPERATION_INVALID, "%s",
-                  _("Domain is not running"));
-      goto cleanup;
-  }
-
-  if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
-      openvzSetProgramSentinal(prog, vm->def->name);
-      if (virRun(prog, NULL) < 0) {
-          goto cleanup;
-      }
-      virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
-  }
-
-  ret = 0;
+static int openvzDomainResume(virDomainPtr dom)
+{
+    struct openvz_driver *driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINAL, "--resume", NULL};
+    int ret = -1;
+
+    openvzDriverLock(driver);
+    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+    openvzDriverUnlock(driver);
+
+    if (!vm) {
+        openvzError(VIR_ERR_NO_DOMAIN, "%s",
+                    _("no domain with matching uuid"));
+        goto cleanup;
+    }
+
+    if (!virDomainObjIsActive(vm)) {
+        openvzError(VIR_ERR_OPERATION_INVALID, "%s",
+                    _("Domain is not running"));
+        goto cleanup;
+    }
+
+    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
+        openvzSetProgramSentinal(prog, vm->def->name);
+        if (virRun(prog, NULL) < 0) {
+            goto cleanup;
+        }
+        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
+    }
+
+    ret = 0;
 
 cleanup:
-  if (vm)
-      virDomainObjUnlock(vm);
-  return ret;
+    if (vm)
+        virDomainObjUnlock(vm);
+    return ret;
 }
 
 static int openvzDomainShutdown(virDomainPtr dom) {
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ad62a07..778def4 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1025,7 +1025,7 @@ qemuCapsComputeCmdFlags(const char *help,
      * two features. The benefits of JSON mode now outweigh
      * the downside.
      */
-     if (version >= 13000)
+    if (version >= 13000)
         qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
 
     if (version >= 13000)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6e4480e..b47368c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -662,7 +662,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps)
 
     return 0;
 
-    no_memory:
+no_memory:
     virReportOOMError();
     return -1;
 }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 52b7dfd..2301424 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8027,8 +8027,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
         event = virDomainEventNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_STARTED,
                                          VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT);
-    }
-    else {
+    } else {
         /* qemu is a little funny with running guests and the restoration
          * of snapshots.  If the snapshot was taken online,
          * then after a "loadvm" monitor command, the VM is set running
@@ -8113,8 +8112,7 @@ static int qemuDomainSnapshotDiscard(struct qemud_driver *driver,
                 }
             }
         }
-    }
-    else {
+    } else {
         priv = vm->privateData;
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
         /* we continue on even in the face of error */
@@ -8135,9 +8133,9 @@ static int qemuDomainSnapshotDiscard(struct qemud_driver *driver,
 
             /* Now we set the new current_snapshot for the domain */
             vm->current_snapshot = parentsnap;
-        }
-        else
+        } else {
             vm->current_snapshot = NULL;
+        }
     }
 
     if (virAsprintf(&snapFile, "%s/%s/%s.xml", driver->snapshotDir,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c9145cb..cdb0193 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -819,7 +819,6 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
 error:
-
     return ret;
 }
 
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 615de6c..e3217ac 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -936,7 +936,6 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
             return 0;
         }
 
-
         if (fds[0].revents & (POLLHUP | POLLERR)) {
             virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
                         _("received hangup / error event on socket"));
@@ -944,7 +943,6 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
         }
     }
 
-
 error:
     client->waitDispatch = thiscall->next;
     VIR_DEBUG("Giving up the buck due to I/O error %p %p", thiscall, client->waitDispatch);
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index 8c250e2..dae172c 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -131,7 +131,6 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
             goto error;
     }
 
-
     return svc;
 
 no_memory:
@@ -187,7 +186,6 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
             goto error;
     }
 
-
     return svc;
 
 no_memory:
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index f0f053b..2fb31cb 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1762,7 +1762,6 @@ static int umlDomainAttachUmlDisk(struct uml_driver *driver,
     return 0;
 
 error:
-
     VIR_FREE(reply);
     VIR_FREE(cmd);
 
@@ -1818,7 +1817,6 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
     }
 
 cleanup:
-
     virDomainDeviceDefFree(dev);
     if (vm)
         virDomainObjUnlock(vm);
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 88febba..af83e8e 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -347,7 +347,6 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
     priv->xendConfigVersion = -1;
     priv->xshandle = NULL;
 
-
     /* Hypervisor is only run with privilege & required to succeed */
     if (xenHavePrivilege()) {
         VIR_DEBUG("Trying hypervisor sub-driver");
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 04bf93a..e7aaf60 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -1333,7 +1333,7 @@ retry:
     if (new_domain_cnt < 0)
         return -1;
 
-    if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
+    if (VIR_ALLOC_N(new_domids, new_domain_cnt) < 0) {
         virReportOOMError();
         return -1;
     }
@@ -1345,9 +1345,9 @@ retry:
     }
 
     missing = 0;
-    for (i=0 ; i < new_domain_cnt ; i++) {
+    for (i = 0; i < new_domain_cnt; i++) {
         found = 0;
-        for (j = 0 ; j < priv->activeDomainList->count ; j++) {
+        for (j = 0; j < priv->activeDomainList->count; j++) {
             if (priv->activeDomainList->doms[j]->id == new_domids[i]) {
                 found = 1;
                 break;
@@ -1416,7 +1416,7 @@ retry:
     if (new_domain_cnt < 0)
         return -1;
 
-    if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
+    if (VIR_ALLOC_N(new_domids, new_domain_cnt) < 0 ) {
         virReportOOMError();
         return -1;
     }
@@ -1428,9 +1428,9 @@ retry:
     }
 
     removed = 0;
-    for (j=0 ; j < priv->activeDomainList->count ; j++) {
+    for (j = 0; j < priv->activeDomainList->count; j++) {
         found = 0;
-        for (i=0 ; i < new_domain_cnt ; i++) {
+        for (i = 0; i < new_domain_cnt; i++) {
             if (priv->activeDomainList->doms[j]->id == new_domids[i]) {
                 found = 1;
                 break;
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 0ad2179..511d1f5 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1426,7 +1426,6 @@ virConfPtr xenFormatXM(virConnectPtr conn,
     if (!(conf = virConfNew()))
         goto cleanup;
 
-
     if (xenXMConfigSetString(conf, "name", def->name) < 0)
         goto no_memory;
 
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index f6c7274..34b1df7 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -292,13 +292,11 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
         goto cleanup;
     }
 
-
     if (virNetSocketAccept(lsock, &ssock) < 0) {
         VIR_DEBUG("Unexpected client socket missing");
         goto cleanup;
     }
 
-
     if (STRNEQ(virNetSocketLocalAddrString(ssock), "127.0.0.1;0")) {
         VIR_DEBUG("Unexpected local address");
         goto cleanup;
@@ -309,7 +307,6 @@ static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
         goto cleanup;
     }
 
-
     ret = 0;
 
 cleanup:
-- 
1.7.4.1




More information about the libvir-list mailing list