[PATCH] cleanup spaces between parentheses and curly brackets

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

 



And add a syntax-check for '){$'.  It's not perfect, but better than
nothing.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 cfg.mk                          |  6 ++++++
 docs/java.html.in               |  4 ++--
 src/conf/domain_conf.c          |  2 +-
 src/conf/node_device_conf.c     |  2 +-
 src/conf/nwfilter_params.c      |  2 +-
 src/conf/storage_conf.c         |  2 +-
 src/libvirt.c                   |  8 ++++----
 src/lxc/lxc_driver.c            |  4 ++--
 src/qemu/qemu_driver.c          |  2 +-
 src/qemu/qemu_monitor_json.c    |  2 +-
 src/rpc/virnettlscontext.c      |  2 +-
 src/security/virt-aa-helper.c   |  2 +-
 src/util/virdnsmasq.c           |  2 +-
 src/util/virstorageencryption.c |  2 +-
 src/xen/xen_driver.c            |  2 +-
 src/xen/xen_hypervisor.c        | 22 +++++++++++-----------
 src/xen/xend_internal.c         |  6 +++---
 tests/libvirtdconftest.c        |  2 +-
 tools/virsh-volume.c            |  2 +-
 19 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 4e302c8..825e5ce 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -943,6 +943,12 @@ sc_prohibit_empty_first_line:
 	  print "$(ME): Prohibited empty first line" > "/dev/stderr";	\
 	} exit fail; }' $$($(VC_LIST_EXCEPT));

+sc_prohibit_parentheses_conjuncted_with_curly_bracket:
+	@prohibit='\)\{$$'						\
+	in_vc_files='\.[ch]$$'						\
+	halt='put space between parentheses and curly bracket'		\
+	  $(_sc_search_regexp)
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null

diff --git a/docs/java.html.in b/docs/java.html.in
index b5812ba..daa7b76 100644
--- a/docs/java.html.in
+++ b/docs/java.html.in
@@ -130,7 +130,7 @@ public class minitest {
         Connect conn=null;
         try{
             conn = new <span style="color: #0071FF; background-color: #FFFFFF">Connect</span>("test:///default", true);
-        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
+        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e) {
             System.out.println("exception caught:"+e);
             System.out.println(e.getError());
         }
@@ -139,7 +139,7 @@ public class minitest {
             System.out.println("Domain:" + testDomain.<span style="color: #E50073; background-color: #FFFFFF">getName</span>() + " id " +
                                testDomain.<span style="color: #E50073; background-color: #FFFFFF">getID</span>() + " running " +
                                testDomain.<span style="color: #E50073; background-color: #FFFFFF">getOSType</span>());
-        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
+        } catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e) {
             System.out.println("exception caught:"+e);
             System.out.println(e.getError());
         }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d14191f..9557020 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14423,7 +14423,7 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
                        dst->os.type, src->os.type);
         goto error;
     }
-    if (src->os.arch != dst->os.arch){
+    if (src->os.arch != dst->os.arch) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain architecture %s does not match source %s"),
                        virArchToString(dst->os.arch),
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 025d08c..54290ae 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -187,7 +187,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
     }
     virNodeDeviceObjLock(device);

-    if (VIR_APPEND_ELEMENT_COPY(devs->objs, devs->count, device) < 0){
+    if (VIR_APPEND_ELEMENT_COPY(devs->objs, devs->count, device) < 0) {
         virNodeDeviceObjUnlock(device);
         virNodeDeviceObjFree(device);
         return NULL;
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index a12e645..e561943 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -724,7 +724,7 @@ addToTable(void *payload, const void *name, void *data)
         return;
     }

-    if (virNWFilterHashTablePut(atts->target, (const char *)name, val) < 0){
+    if (virNWFilterHashTablePut(atts->target, (const char *)name, val) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Could not put variable '%s' into hashmap"),
                        (const char *)name);
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index b61d8c0..5a16767 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2122,7 +2122,7 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
                           def->source.adapter.data.fchost.wwpn))
                     matchpool = pool;
             } else if (pool->def->source.adapter.type ==
-                       VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST){
+                       VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
                 if (pool->def->source.adapter.data.scsi_host.name) {
                     if (STREQ(pool->def->source.adapter.data.scsi_host.name,
                               def->source.adapter.data.scsi_host.name))
diff --git a/src/libvirt.c b/src/libvirt.c
index 992e4f2..8349261 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -7613,7 +7613,7 @@ virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
     virCheckDomainReturn(domain, NULL);
     conn = domain->conn;

-    if (conn->driver->domainGetSchedulerType){
+    if (conn->driver->domainGetSchedulerType) {
         schedtype = conn->driver->domainGetSchedulerType(domain, nparams);
         if (!schedtype)
             goto error;
@@ -10987,7 +10987,7 @@ virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virCheckConnectReturn(conn, NULL);
     virCheckNonNullArgGoto(uuid, error);

-    if (conn->networkDriver && conn->networkDriver->networkLookupByUUID){
+    if (conn->networkDriver && conn->networkDriver->networkLookupByUUID) {
         virNetworkPtr ret;
         ret = conn->networkDriver->networkLookupByUUID(conn, uuid);
         if (!ret)
@@ -14217,7 +14217,7 @@ virStorageVolGetInfo(virStorageVolPtr vol,

     conn = vol->conn;

-    if (conn->storageDriver->storageVolGetInfo){
+    if (conn->storageDriver->storageVolGetInfo) {
         int ret;
         ret = conn->storageDriver->storageVolGetInfo(vol, info);
         if (ret < 0)
@@ -16964,7 +16964,7 @@ virNWFilterLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virCheckConnectReturn(conn, NULL);
     virCheckNonNullArgGoto(uuid, error);

-    if (conn->nwfilterDriver && conn->nwfilterDriver->nwfilterLookupByUUID){
+    if (conn->nwfilterDriver && conn->nwfilterDriver->nwfilterLookupByUUID) {
         virNWFilterPtr ret;
         ret = conn->nwfilterDriver->nwfilterLookupByUUID(conn, uuid);
         if (!ret)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index d65dda0..66d708a 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2193,7 +2193,7 @@ lxcDomainParseBlkioDeviceStr(char *blkioDeviceStr, const char *type,
         } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS)) {
             if (virStrToLong_ullp(temp, &p, 10, &result[i].rbps) < 0)
                 goto error;
-        } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)){
+        } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
             if (virStrToLong_ullp(temp, &p, 10, &result[i].wbps) < 0)
                 goto error;
         } else {
@@ -2606,7 +2606,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
                             break;
                         }
                     }
-                } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)){
+                } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
                     for (j = 0; j < ndevices; j++) {
                         if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
                                                             devices[j].path,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 28a56a9..2c56692 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7865,7 +7865,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
                             break;
                         }
                     }
-                } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)){
+                } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
                     for (j = 0; j < ndevices; j++) {
                         if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
                                                             devices[j].path,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a62c02f..3972960 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3868,7 +3868,7 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
             virReportError(VIR_ERR_OPERATION_INVALID,
                            _("No active operation on device: %s"),
                            device);
-        } else if (qemuMonitorJSONHasError(reply, "DeviceInUse")){
+        } else if (qemuMonitorJSONHasError(reply, "DeviceInUse")) {
             virReportError(VIR_ERR_OPERATION_FAILED,
                            _("Device %s in use"), device);
         } else if (qemuMonitorJSONHasError(reply, "NotSupported")) {
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 032ff64..31aac9d 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -1003,7 +1003,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt,

     memset(dname, 0, dnamesize);

-    if ((ret = gnutls_certificate_verify_peers2(sess->session, &status)) < 0){
+    if ((ret = gnutls_certificate_verify_peers2(sess->session, &status)) < 0) {
         virReportError(VIR_ERR_SYSTEM_ERROR,
                        _("Unable to verify TLS peer: %s"),
                        gnutls_strerror(ret));
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index f25a7df7..a0b104c 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1075,7 +1075,7 @@ get_files(vahControl * ctl)
                 ctl->def->fss[i]->type == VIR_DOMAIN_FS_TYPE_MOUNT &&
                 (ctl->def->fss[i]->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_PATH ||
                  ctl->def->fss[i]->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) &&
-                ctl->def->fss[i]->src){
+                ctl->def->fss[i]->src) {
             virDomainFSDefPtr fs = ctl->def->fss[i];

             if (vah_add_path(&buf, fs->src, fs->readonly ? "r" : "rw", true) != 0)
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 5991fe7..d2c4aa9 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -332,7 +332,7 @@ hostsfileAdd(dnsmasqHostsfile *hostsfile,
         if (virAsprintf(&hostsfile->hosts[hostsfile->nhosts].host, "%s,%s,%s",
                         mac, ipstr, name) < 0)
             goto error;
-    } else if (name && !mac){
+    } else if (name && !mac) {
         if (virAsprintf(&hostsfile->hosts[hostsfile->nhosts].host, "%s,%s",
                         name, ipstr) < 0)
             goto error;
diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c
index 5a401b7..b5fed58 100644
--- a/src/util/virstorageencryption.c
+++ b/src/util/virstorageencryption.c
@@ -193,7 +193,7 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
     ret->format = format;

     n = virXPathNodeSet("./secret", ctxt, &nodes);
-    if (n < 0){
+    if (n < 0) {
         goto cleanup;
     }
     if (n != 0 && VIR_ALLOC_N(ret->secrets, n) < 0)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 79df3ee..0fc3aca 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2534,7 +2534,7 @@ xenUnifiedNodeDeviceAssignedDomainId(virNodeDevicePtr dev)
     if (numdomains < 0) {
         return ret;
     }
-    if (numdomains > 0){
+    if (numdomains > 0) {
         if (VIR_ALLOC_N(ids, numdomains) < 0)
             goto out;
         if ((numdomains = xenUnifiedConnectListDomains(conn, &ids[0], numdomains)) < 0) {
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 09aa1aa..0931234 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -1194,7 +1194,7 @@ xenHypervisorGetSchedulerType(virConnectPtr conn,
         if (ret < 0)
             return NULL;

-        switch (op.u.getschedulerid.sched_id){
+        switch (op.u.getschedulerid.sched_id) {
             case XEN_SCHEDULER_SEDF:
                 ignore_value(VIR_STRDUP(schedulertype, "sedf"));
                 if (nparams)
@@ -1257,7 +1257,7 @@ xenHypervisorGetSchedulerParameters(virConnectPtr conn,
         if (ret < 0)
             return -1;

-        switch (op_sys.u.getschedulerid.sched_id){
+        switch (op_sys.u.getschedulerid.sched_id) {
             case XEN_SCHEDULER_SEDF:
                 if (*nparams < XEN_SCHED_SEDF_NPARAM) {
                     virReportError(VIR_ERR_INVALID_ARG,
@@ -1360,7 +1360,7 @@ xenHypervisorSetSchedulerParameters(virConnectPtr conn,
         ret = xenHypervisorDoV2Sys(priv->handle, &op_sys);
         if (ret == -1) return -1;

-        switch (op_sys.u.getschedulerid.sched_id){
+        switch (op_sys.u.getschedulerid.sched_id) {
         case XEN_SCHEDULER_SEDF:
             /* TODO: Implement for Xen/SEDF */
             TODO
@@ -1885,13 +1885,13 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         /* RHEL 5.0 */
         hv_versions.dom_interface = 3; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver2 dom ver3");
             goto done;
         }
         /* Fedora 7 */
         hv_versions.dom_interface = 4; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver2 dom ver4");
             goto done;
         }
@@ -1901,7 +1901,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         /* xen-3.1 */
         hv_versions.dom_interface = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver3 dom ver5");
             goto done;
         }
@@ -1911,7 +1911,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         /* Fedora 8 */
         hv_versions.dom_interface = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver4 dom ver5");
             goto done;
         }
@@ -1921,7 +1921,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         /* Xen 3.2, Fedora 9 */
         hv_versions.dom_interface = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver6 dom ver5");
             goto done;
         }
@@ -1943,12 +1943,12 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     hv_versions.sys_interface = 8; /* XEN_SYSCTL_INTERFACE_VERSION */
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         hv_versions.dom_interface = 7; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver8 dom ver7");
             goto done;
         }
         hv_versions.dom_interface = 8; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver8 dom ver8");
             goto done;
         }
@@ -1961,7 +1961,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
     hv_versions.sys_interface = 9; /* XEN_SYSCTL_INTERFACE_VERSION */
     if (virXen_getdomaininfo(fd, 0, &info) == 1) {
         hv_versions.dom_interface = 8; /* XEN_DOMCTL_INTERFACE_VERSION */
-        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+        if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0) {
             VIR_DEBUG("Using hypervisor call v2, sys ver9 dom ver8");
             goto done;
         }
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 519a58f..6d1fec7 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -2976,7 +2976,7 @@ xenDaemonGetSchedulerType(virConnectPtr conn,

     /* get xen_scheduler from xend/node */
     ret = sexpr_node(root, "node/xen_scheduler");
-    if (ret == NULL){
+    if (ret == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("node information incomplete, missing scheduler name"));
         goto error;
@@ -3047,7 +3047,7 @@ xenDaemonGetSchedulerParameters(virConnectPtr conn,
         goto error;
     }

-    switch (sched_nparam){
+    switch (sched_nparam) {
         case XEN_SCHED_SEDF_NPARAM:
             if (*nparams < XEN_SCHED_SEDF_NPARAM) {
                 virReportError(VIR_ERR_INVALID_ARG,
@@ -3152,7 +3152,7 @@ xenDaemonSetSchedulerParameters(virConnectPtr conn,
         goto error;
     }

-    switch (sched_nparam){
+    switch (sched_nparam) {
         case XEN_SCHED_SEDF_NPARAM:
             /* TODO: Implement for Xen/SEDF */
             TODO
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c
index 13cfa60..8b93f4e 100644
--- a/tests/libvirtdconftest.c
+++ b/tests/libvirtdconftest.c
@@ -217,7 +217,7 @@ mymain(void)
         goto cleanup;
     }

-    if (uncomment_all_params(filedata, &params) < 0){
+    if (uncomment_all_params(filedata, &params) < 0) {
         perror("Find params");
         ret = -1;
         goto cleanup;
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index b528928..4f810f8 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1123,7 +1123,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd)
     if (*capacityStr == '-') {
         /* The API always requires a positive value; but we allow a
          * negative value for convenience.  */
-        if (delta && vshCommandOptBool(cmd, "shrink")){
+        if (delta && vshCommandOptBool(cmd, "shrink")) {
             capacityStr++;
         } else {
             vshError(ctl, "%s",
-- 
2.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]