[libvirt] [PATCH 27/29] tools: Add spaces after casts

Martin Kletzander mkletzan at redhat.com
Mon Apr 23 12:44:55 UTC 2018


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 tools/nss/libvirt_nss.c              |  4 ++--
 tools/virsh-domain-monitor.c         |  4 ++--
 tools/virsh-domain.c                 | 36 ++++++++++++++--------------
 tools/virsh-host.c                   |  4 ++--
 tools/virsh-secret.c                 |  2 +-
 tools/virsh-volume.c                 |  2 +-
 tools/virt-host-validate-qemu.c      |  2 +-
 tools/vsh.c                          |  4 ++--
 tools/wireshark/src/packet-libvirt.c |  8 +++----
 9 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 62fe589bed7e..afabaf20fc05 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -681,7 +681,7 @@ _nss_compat_getaddrinfo(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list ap)
         h_errno = HOST_NOT_FOUND;
         return NS_NOTFOUND;
     }
-    *((struct addrinfo **)retval) = sentinel.ai_next;
+    *((struct addrinfo **) retval) = sentinel.ai_next;
 
     return NS_SUCCESS;
 }
@@ -708,7 +708,7 @@ _nss_compat_gethostbyname2_r(void *retval, void *mdata ATTRIBUTE_UNUSED, va_list
     herrnop = va_arg(ap, int *);
 
     ret = NSS_NAME(gethostbyname2)(name, af, result, buffer, buflen, errnop, herrnop);
-    *(struct hostent **)retval = (ret == NS_SUCCESS) ? result : NULL;
+    *(struct hostent **) retval = (ret == NS_SUCCESS) ? result : NULL;
 
     return ret;
 }
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 8e071779b4ef..15133def92a6 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1150,7 +1150,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
         return false;
 
     id = virDomainGetID(dom);
-    if (id == ((unsigned int)-1))
+    if (id == ((unsigned int) -1))
         vshPrint(ctl, "%-15s %s\n", _("Id:"), "-");
     else
         vshPrint(ctl, "%-15s %d\n", _("Id:"), id);
@@ -1795,7 +1795,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
     bool ret = false;
     virshDomainListPtr list = NULL;
     virDomainPtr dom;
-    char id_buf[INT_BUFSIZE_BOUND(unsigned int)];
+    char id_buf[INT_BUFSIZE_BOUND(unsigned int) ];
     unsigned int id;
     unsigned int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 2b775fc4cca6..7ebe4dc30cac 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -370,7 +370,7 @@ static int str2PCIAddress(const char *str, struct PCIAddress *pciAddr)
     if (!str)
         return -1;
 
-    domain = (char *)str;
+    domain = (char *) str;
 
     if (virStrToLong_uip(domain, &bus, 16, &pciAddr->domain) != 0)
         return -1;
@@ -399,7 +399,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
     if (!str)
         return -1;
 
-    controller = (char *)str;
+    controller = (char *) str;
 
     if (virStrToLong_uip(controller, &bus, 10, &scsiAddr->controller) != 0)
         return -1;
@@ -424,7 +424,7 @@ static int str2IDEAddress(const char *str, struct IDEAddress *ideAddr)
     if (!str)
         return -1;
 
-    controller = (char *)str;
+    controller = (char *) str;
 
     if (virStrToLong_uip(controller, &bus, 10, &ideAddr->controller) != 0)
         return -1;
@@ -449,7 +449,7 @@ static int str2CCWAddress(const char *str, struct CCWAddress *ccwAddr)
     if (!str)
         return -1;
 
-    cssid = (char *)str;
+    cssid = (char *) str;
 
     if (virStrToLong_uip(cssid, &ssid, 16, &ccwAddr->cssid) != 0)
         return -1;
@@ -480,7 +480,7 @@ static int str2DiskAddress(const char *str, struct DiskAddress *diskAddr)
     if (!str)
         return -1;
 
-    type = (char *)str;
+    type = (char *) str;
     addr = strchr(type, ':');
     if (!addr)
         return -1;
@@ -625,7 +625,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
             goto cleanup;
         }
 
-        if (STRPREFIX((const char *)target, "vd")) {
+        if (STRPREFIX((const char *) target, "vd")) {
             if (diskAddr.type == DISK_ADDR_TYPE_PCI) {
                 virBufferAsprintf(&buf,
                                   "<address type='pci' domain='0x%04x'"
@@ -646,7 +646,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
                          _("expecting a pci:0000.00.00.00 or ccw:00.0.0000 address."));
                 goto cleanup;
             }
-        } else if (STRPREFIX((const char *)target, "sd")) {
+        } else if (STRPREFIX((const char *) target, "sd")) {
             if (diskAddr.type == DISK_ADDR_TYPE_SCSI) {
                 virBufferAsprintf(&buf,
                                   "<address type='drive' controller='%u'"
@@ -657,7 +657,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
                 vshError(ctl, "%s", _("expecting a scsi:00.00.00 address."));
                 goto cleanup;
             }
-        } else if (STRPREFIX((const char *)target, "hd")) {
+        } else if (STRPREFIX((const char *) target, "hd")) {
             if (diskAddr.type == DISK_ADDR_TYPE_IDE) {
                 virBufferAsprintf(&buf,
                                   "<address type='drive' controller='%u'"
@@ -862,7 +862,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
         goto cleanup;
 
     /* check interface type */
-    if ((int)(typ = virDomainNetTypeFromString(type)) < 0) {
+    if ((int) (typ = virDomainNetTypeFromString(type)) < 0) {
         vshError(ctl, _("No support for %s in command 'attach-interface'"),
                  type);
         goto cleanup;
@@ -1604,7 +1604,7 @@ virshPrintJobProgress(const char *label, unsigned long long remaining,
         progress = 100;
     } else {
         /* use float to avoid overflow */
-        progress = (int)(100.0 - remaining * 100.0 / total);
+        progress = (int) (100.0 - remaining * 100.0 / total);
         if (progress >= 100) {
             /* migration has not completed, do not print [100 %] */
             progress = 99;
@@ -4021,7 +4021,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
                                         VIRSH_BYNAME | VIRSH_BYUUID)))
         return false;
 
-    if (virDomainGetID(dom) != (unsigned int)-1) {
+    if (virDomainGetID(dom) != (unsigned int) -1) {
         vshError(ctl, "%s", _("Domain is already active"));
         goto cleanup;
     }
@@ -4226,7 +4226,7 @@ virshWatchJob(vshControl *ctl,
 
     GETTIMEOFDAY(&start);
     while (1) {
-        ret = poll((struct pollfd *)&pollfd, npollfd, 500);
+        ret = poll((struct pollfd *) &pollfd, npollfd, 500);
         if (ret > 0) {
             if (pollfd[1].revents & POLLIN &&
                 saferead(STDIN_FILENO, &retchar, sizeof(retchar)) > 0) {
@@ -4259,8 +4259,8 @@ virshWatchJob(vshControl *ctl,
         }
 
         GETTIMEOFDAY(&curr);
-        if (timeout_ms && (((int)(curr.tv_sec - start.tv_sec)  * 1000 +
-                            (int)(curr.tv_usec - start.tv_usec) / 1000) >
+        if (timeout_ms && (((int) (curr.tv_sec - start.tv_sec)  * 1000 +
+                            (int) (curr.tv_usec - start.tv_usec) / 1000) >
                            timeout_ms)) {
             /* suspend the domain when migration timeouts. */
             vshDebug(ctl, VSH_ERR_DEBUG, "%s timeout", label);
@@ -7859,7 +7859,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
     }
 
     result = virConnectBaselineCPU(priv->conn,
-                                   (const char **)list, count, flags);
+                                   (const char **) list, count, flags);
 
     if (result) {
         vshPrint(ctl, "%s", result);
@@ -10326,7 +10326,7 @@ cmdDomid(vshControl *ctl, const vshCmd *cmd)
         return false;
 
     id = virDomainGetID(dom);
-    if (id == ((unsigned int)-1))
+    if (id == ((unsigned int) -1))
         vshPrint(ctl, "%s\n", "-");
     else
         vshPrint(ctl, "%d\n", id);
@@ -10626,7 +10626,7 @@ doMigrate(void *opaque)
                                         &nparams,
                                         &maxparams,
                                         VIR_MIGRATE_PARAM_MIGRATE_DISKS,
-                                        (const char **)val) < 0) {
+                                        (const char **) val) < 0) {
             VIR_FREE(val);
             goto save_error;
         }
@@ -10643,7 +10643,7 @@ doMigrate(void *opaque)
                                         &nparams,
                                         &maxparams,
                                         VIR_MIGRATE_PARAM_COMPRESSION,
-                                        (const char **)val) < 0) {
+                                        (const char **) val) < 0) {
             VIR_FREE(val);
             goto save_error;
         }
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index ecaf830e350d..91c0e57272c9 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -290,8 +290,8 @@ static const vshCmdOptDef opts_freepages[] = {
 static int
 vshPageSizeSorter(const void *a, const void *b)
 {
-    unsigned int pa = *(unsigned int *)a;
-    unsigned int pb = *(unsigned int *)b;
+    unsigned int pa = *(unsigned int *) a;
+    unsigned int pb = *(unsigned int *) b;
 
     return pa - pb;
 }
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 9e4ec61a8807..e2b097e3f733 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -214,7 +214,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
         goto cleanup;
     }
 
-    res = virSecretSetValue(secret, (unsigned char *)value, value_size, 0);
+    res = virSecretSetValue(secret, (unsigned char *) value, value_size, 0);
     memset(value, 0, value_size);
     VIR_FREE(value);
 
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 9d6ebd2325a5..2a590d7dd826 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -536,7 +536,7 @@ virshMakeCloneXML(const char *origxml, const char *newname)
         obj->nodesetval->nodeTab == NULL)
         goto cleanup;
 
-    xmlNodeSetContent(obj->nodesetval->nodeTab[0], (const xmlChar *)newname);
+    xmlNodeSetContent(obj->nodesetval->nodeTab[0], (const xmlChar *) newname);
     xmlDocDumpMemory(doc, &newxml, &size);
 
  cleanup:
diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index d7573ea8b3dd..22b92a5d1d19 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -40,7 +40,7 @@ int virHostValidateQEMU(void)
     if (!(flags = virHostValidateGetCPUFlags()))
         return -1;
 
-    switch ((int)arch) {
+    switch ((int) arch) {
     case VIR_ARCH_I686:
     case VIR_ARCH_X86_64:
         hasVirtFlag = true;
diff --git a/tools/vsh.c b/tools/vsh.c
index 73ec007e5622..babdbb542e45 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -162,7 +162,7 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
     if (VIR_STRDUP(x, s) >= 0)
         return x;
     vshError(ctl, _("%s: %d: failed to allocate %lu bytes"),
-             filename, line, (unsigned long)strlen(s));
+             filename, line, (unsigned long) strlen(s));
     exit(EXIT_FAILURE);
 }
 
@@ -373,7 +373,7 @@ vshCmddefCheckInternals(const vshCmdDef *cmd)
 
         case VSH_OT_ALIAS: {
             size_t j;
-            char *name = (char *)opt->help; /* cast away const */
+            char *name = (char *) opt->help; /* cast away const */
             char *p;
 
             if (opt->flags || !opt->help)
diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c
index 71f0f6114a68..421f116f77e3 100644
--- a/tools/wireshark/src/packet-libvirt.c
+++ b/tools/wireshark/src/packet-libvirt.c
@@ -95,7 +95,7 @@ dissect_xdr_string(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf,
     start = xdr_getpos(xdrs);
     if (xdr_string(xdrs, &val, maxlen)) {
         proto_tree_add_string(tree, hf, tvb, start, xdr_getpos(xdrs) - start, val);
-        xdr_free((xdrproc_t)xdr_string, (char *)&val);
+        xdr_free((xdrproc_t)xdr_string, (char *) &val);
         return TRUE;
     } else {
         proto_tree_add_item(tree, hf_libvirt_unknown, tvb, start, -1, ENC_NA);
@@ -151,7 +151,7 @@ dissect_xdr_bytes(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf,
     guint32 length;
 
     start = xdr_getpos(xdrs);
-    if (xdr_bytes(xdrs, (char **)&val, &length, maxlen)) {
+    if (xdr_bytes(xdrs, (char **) &val, &length, maxlen)) {
         proto_tree_add_bytes_format_value(tree, hf, tvb, start, xdr_getpos(xdrs) - start,
                                           NULL, "%s", format_xdr_bytes(val, length));
         /* Seems I can't call xdr_free() for this case.
@@ -374,7 +374,7 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree,
 
     if (status == VIR_NET_OK) {
         vir_xdr_dissector_t xd = find_payload_dissector(proc, type, get_program_data(prog, VIR_PROGRAM_DISSECTORS),
-                                                        *(gsize *)get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN));
+                                                        *(gsize *) get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN));
         if (xd == NULL)
             goto unknown;
         dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status, xd);
@@ -445,7 +445,7 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
         proto_tree_add_item(libvirt_tree, hf_libvirt_program, tvb, offset, 4, ENC_NA); offset += 4;
         proto_tree_add_item(libvirt_tree, hf_libvirt_version, tvb, offset, 4, ENC_NA); offset += 4;
 
-        hf_proc = (int *)get_program_data(prog, VIR_PROGRAM_PROCHFVAR);
+        hf_proc = (int *) get_program_data(prog, VIR_PROGRAM_PROCHFVAR);
         if (hf_proc != NULL && *hf_proc != -1) {
             proto_tree_add_item(libvirt_tree, *hf_proc, tvb, offset, 4, ENC_NA);
         } else {
-- 
2.17.0




More information about the libvir-list mailing list