[libvirt] [PATCH 12/29] nwfilter: Add spaces after casts

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


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/nwfilter/nwfilter_dhcpsnoop.c         | 14 +++++++-------
 src/nwfilter/nwfilter_ebiptables_driver.c | 22 +++++++++++-----------
 src/nwfilter/nwfilter_gentech_driver.c    |  6 +++---
 src/nwfilter/nwfilter_learnipaddr.c       |  8 ++++----
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 6069e7046075..b29d654e4780 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -319,7 +319,7 @@ virNWFilterSnoopActivate(virNWFilterSnoopReqPtr req)
 
     virNWFilterSnoopActiveLock();
 
-    if (virHashAddEntry(virNWFilterSnoopState.active, key, (void *)0x1) < 0)
+    if (virHashAddEntry(virNWFilterSnoopState.active, key, (void *) 0x1) < 0)
         VIR_FREE(key);
 
     virNWFilterSnoopActiveUnlock();
@@ -936,7 +936,7 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
                 goto malformed;
             if (*pleasetime)
                 return -1;  /* duplicate lease time */
-            memcpy(&nwint, (char *)pd->d_opts + oind + 2, sizeof(nwint));
+            memcpy(&nwint, (char *) pd->d_opts + oind + 2, sizeof(nwint));
             *pleasetime = ntohl(nwint);
             break;
         case DHCPO_MTYPE:
@@ -1017,7 +1017,7 @@ virNWFilterSnoopDHCPDecode(virNWFilterSnoopReqPtr req,
      */
     if (!fromVM) {
         if (virMacAddrCmpRaw(&req->macaddr,
-                             (unsigned char *)&pd->d_chaddr) != 0)
+                             (unsigned char *) &pd->d_chaddr) != 0)
             return -2;
     }
 
@@ -1456,7 +1456,7 @@ virNWFilterDHCPSnoopThread(void *req0)
             n--;
 
             rv = pcap_next_ex(pcapConf[i].handle, &hdr,
-                              (const u_char **)&packet);
+                              (const u_char **) &packet);
 
             if (rv < 0) {
                 /* error reading from socket */
@@ -1881,7 +1881,7 @@ virNWFilterSnoopSaveIter(void *payload,
                          void *data)
 {
     virNWFilterSnoopReqPtr req = payload;
-    int tfd = *(int *)data;
+    int tfd = *(int *) data;
     virNWFilterSnoopIPLeasePtr ipl;
 
     /* protect req->start */
@@ -1925,7 +1925,7 @@ virNWFilterSnoopLeaseFileRefresh(void)
                          virNWFilterSnoopPruneIter, NULL);
         /* now save them */
         virHashForEach(virNWFilterSnoopState.snoopReqs,
-                       virNWFilterSnoopSaveIter, (void *)&tfd);
+                       virNWFilterSnoopSaveIter, (void *) &tfd);
     }
 
     if (VIR_CLOSE(tfd) < 0) {
@@ -2147,7 +2147,7 @@ virNWFilterDHCPSnoopEnd(const char *ifname)
         goto cleanup;
 
     if (ifname) {
-        ifkey = (char *)virHashLookup(virNWFilterSnoopState.ifnameToKey,
+        ifkey = (char *) virHashLookup(virNWFilterSnoopState.ifnameToKey,
                                       ifname);
         if (!ifkey)
             goto cleanup;
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index b19b07c84548..9914bf3d6bb0 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1188,7 +1188,7 @@ _iptablesCreateRuleInstance(virFirewallPtr fw,
 
     PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
-    switch ((int)rule->prtclType) {
+    switch ((int) rule->prtclType) {
     case VIR_NWFILTER_RULE_PROTOCOL_TCP:
     case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6:
         fwrule = virFirewallAddRule(fw, layer,
@@ -1878,7 +1878,7 @@ ebtablesCreateRuleInstance(virFirewallPtr fw,
 #define INST_ITEM_MASK(S, I, MASK, C) \
     INST_ITEM_2PARMS(S, I, MASK, C, "/")
 
-    switch ((int)rule->prtclType) {
+    switch ((int) rule->prtclType) {
     case VIR_NWFILTER_RULE_PROTOCOL_MAC:
         fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_ETHERNET,
                                     "-t", "nat",
@@ -2682,7 +2682,7 @@ ebtablesCreateTmpSubChainFW(virFirewallPtr fw,
     fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_ETHERNET,
                                 "-t", "nat", "-A", rootchain, NULL);
 
-    switch ((int)protoidx) {
+    switch ((int) protoidx) {
     case L2_PROTO_MAC_IDX:
         break;
     case L2_PROTO_STP_IDX:
@@ -2722,7 +2722,7 @@ ebtablesRemoveSubChainsQuery(virFirewallPtr fw,
                 VIR_DEBUG("Processing chain '%s'", tmp);
                 virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_ETHERNET,
                                        false, ebtablesRemoveSubChainsQuery,
-                                       (void *)chainprefixes,
+                                       (void *) chainprefixes,
                                         "-t", "nat", "-L", tmp, NULL);
                 virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_ETHERNET,
                                        true, NULL, NULL,
@@ -2750,7 +2750,7 @@ _ebtablesRemoveSubChainsFW(virFirewallPtr fw,
         PRINT_ROOT_CHAIN(rootchain, chainprefixes[i], ifname);
         virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_ETHERNET,
                                false, ebtablesRemoveSubChainsQuery,
-                               (void *)chainprefixes,
+                               (void *) chainprefixes,
                                "-t", "nat", "-L", rootchain, NULL);
     }
 }
@@ -3195,8 +3195,8 @@ ebiptablesFilterOrderSort(const virHashKeyValuePair *a,
                           const virHashKeyValuePair *b)
 {
     /* elements' values has been limited to range [-1000, 1000] */
-    return *(virNWFilterChainPriority *)a->value -
-           *(virNWFilterChainPriority *)b->value;
+    return *(virNWFilterChainPriority *) a->value -
+           *(virNWFilterChainPriority *) b->value;
 }
 
 
@@ -3336,8 +3336,8 @@ struct ebtablesSubChainInst {
 static int
 ebtablesSubChainInstSort(const void *a, const void *b)
 {
-    const struct ebtablesSubChainInst **insta = (const struct ebtablesSubChainInst **)a;
-    const struct ebtablesSubChainInst **instb = (const struct ebtablesSubChainInst **)b;
+    const struct ebtablesSubChainInst **insta = (const struct ebtablesSubChainInst **) a;
+    const struct ebtablesSubChainInst **instb = (const struct ebtablesSubChainInst **) b;
 
     /* priorities are limited to range [-1000, 1000] */
     return (*insta)->priority - (*instb)->priority;
@@ -3364,12 +3364,12 @@ ebtablesGetSubChainInsts(virHashTablePtr chains,
         enum l3_proto_idx idx = ebtablesGetProtoIdxByFiltername(
                                   filter_names[i].key);
 
-        if ((int)idx < 0)
+        if ((int) idx < 0)
             continue;
 
         if (VIR_ALLOC(inst) < 0)
             goto cleanup;
-        inst->priority = *(const virNWFilterChainPriority *)filter_names[i].value;
+        inst->priority = *(const virNWFilterChainPriority *) filter_names[i].value;
         inst->incoming = incoming;
         inst->protoidx = idx;
         inst->filtername = filter_names[i].key;
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 5ef26b6afbe0..f0c840bb0ab9 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -225,8 +225,8 @@ printString(void *payload ATTRIBUTE_UNUSED, const void *name, void *data)
 {
     struct printString *ps = data;
 
-    if ((STREQ((char *)name, NWFILTER_STD_VAR_IP) && !ps->reportIP) ||
-        (STREQ((char *)name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC))
+    if ((STREQ((char *) name, NWFILTER_STD_VAR_IP) && !ps->reportIP) ||
+        (STREQ((char *) name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC))
         return 0;
 
     if (virBufferUse(&ps->buf) && ps->separator)
@@ -1078,7 +1078,7 @@ virNWFilterDomainFWUpdateCB(virDomainObjPtr obj,
                         /* filter tree unchanged -- no update needed */
                         ret = virHashAddEntry(cb->skipInterfaces,
                                               net->ifname,
-                                              (void *)~0);
+                                              (void *) ~0);
                     }
                     break;
 
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 9ca063957651..4e10f7b4a239 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -356,7 +356,7 @@ procDHCPOpts(struct dhcp *dhcp, int dhcp_opts_len,
             }
         }
         dhcp_opts_len -= (2 + dhcpopt->len);
-        dhcpopt = (struct dhcp_option*)((char *)dhcpopt + 2 + dhcpopt->len);
+        dhcpopt = (struct dhcp_option*)((char *) dhcpopt + 2 + dhcpopt->len);
     }
 }
 
@@ -499,7 +499,7 @@ learnIPAddressThread(void *arg)
 
             case ETHERTYPE_VLAN:
                 ethHdrSize = sizeof(struct ether_vlan_header);
-                vlan_hdr = (struct ether_vlan_header *)packet;
+                vlan_hdr = (struct ether_vlan_header *) packet;
                 if (ntohs(vlan_hdr->ether_type) != ETHERTYPE_IP ||
                     header.len < ethHdrSize)
                     continue;
@@ -567,7 +567,7 @@ learnIPAddressThread(void *arg)
                                        sizeof(struct udphdr))) {
                         VIR_WARNINGS_NO_CAST_ALIGN
                         struct udphdr *udphdr = (struct udphdr *)
-                                          ((char *)iphdr + iphdr->ihl * 4);
+                                          ((char *) iphdr + iphdr->ihl * 4);
                         VIR_WARNINGS_RESET
                         if (ntohs(udphdr->source) == 67 &&
                             ntohs(udphdr->dest)   == 68 &&
@@ -576,7 +576,7 @@ learnIPAddressThread(void *arg)
                                           sizeof(struct udphdr) +
                                           sizeof(struct dhcp)) {
                             struct dhcp *dhcp = (struct dhcp *)
-                                        ((char *)udphdr + sizeof(udphdr));
+                                        ((char *) udphdr + sizeof(udphdr));
                             if (dhcp->op == 2 /* BOOTREPLY */ &&
                                 virMacAddrCmpRaw(
                                         &req->macaddr,
-- 
2.17.0




More information about the libvir-list mailing list