[PATCH 2/6] Remove pointless brackets around boolean

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

 



A lot of methods have a 'bool incoming' parameter but then
do  (incoming) ? ... : .... The round brackets here add nothing
to the code so can be removed.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/nwfilter/nwfilter_ebiptables_driver.c | 92 +++++++++++++++----------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 2543854..b3405e5 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -648,8 +648,8 @@ iptablesCreateTmpRootChain(virBufferPtr buf,
     char chain[MAX_CHAINNAME_LENGTH];
     char chainPrefix[2] = {
        prefix,
-       (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                  : CHAINPREFIX_HOST_OUT_TEMP
+       incoming ? CHAINPREFIX_HOST_IN_TEMP
+                : CHAINPREFIX_HOST_OUT_TEMP
     };
 
     PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
@@ -688,11 +688,11 @@ _iptablesRemoveRootChain(virBufferPtr buf,
     };
 
     if (isTempChain)
-        chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                    : CHAINPREFIX_HOST_OUT_TEMP;
+        chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                  : CHAINPREFIX_HOST_OUT_TEMP;
     else
-        chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN
-                                    : CHAINPREFIX_HOST_OUT;
+        chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN
+                                  : CHAINPREFIX_HOST_OUT;
 
     PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -759,11 +759,11 @@ iptablesLinkTmpRootChain(virBufferPtr buf,
     char chain[MAX_CHAINNAME_LENGTH];
     char chainPrefix[2] = {
         prefix,
-        (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                   : CHAINPREFIX_HOST_OUT_TEMP
+        incoming ? CHAINPREFIX_HOST_IN_TEMP
+                 : CHAINPREFIX_HOST_OUT_TEMP
     };
-    const char *match = (incoming) ? MATCH_PHYSDEV_IN
-                                   : MATCH_PHYSDEV_OUT;
+    const char *match = incoming ? MATCH_PHYSDEV_IN
+                                 : MATCH_PHYSDEV_OUT;
 
     PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -839,15 +839,15 @@ _iptablesUnlinkRootChain(virBufferPtr buf,
         prefix,
     };
     if (isTempChain)
-        chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                    : CHAINPREFIX_HOST_OUT_TEMP;
+        chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                  : CHAINPREFIX_HOST_OUT_TEMP;
     else
-        chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN
-                                    : CHAINPREFIX_HOST_OUT;
-    const char *match = (incoming) ? MATCH_PHYSDEV_IN
-                                   : MATCH_PHYSDEV_OUT;
-    const char *old_match = (incoming) ? NULL
-                                       : MATCH_PHYSDEV_OUT_OLD;
+        chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN
+                                  : CHAINPREFIX_HOST_OUT;
+    const char *match = incoming ? MATCH_PHYSDEV_IN
+                                 : MATCH_PHYSDEV_OUT;
+    const char *old_match = incoming ? NULL
+                                     : MATCH_PHYSDEV_OUT_OLD;
 
     PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -927,13 +927,13 @@ iptablesRenameTmpRootChain(virBufferPtr buf,
     char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
     char tmpChainPrefix[2] = {
         prefix,
-        (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                   : CHAINPREFIX_HOST_OUT_TEMP
+        incoming ? CHAINPREFIX_HOST_IN_TEMP
+                 : CHAINPREFIX_HOST_OUT_TEMP
     };
     char chainPrefix[2] = {
         prefix,
-        (incoming) ? CHAINPREFIX_HOST_IN
-                   : CHAINPREFIX_HOST_OUT
+        incoming ? CHAINPREFIX_HOST_IN
+                 : CHAINPREFIX_HOST_OUT
     };
 
     PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
@@ -2873,8 +2873,8 @@ ebtablesCreateTmpRootChain(virBufferPtr buf,
                            int stopOnError)
 {
     char chain[MAX_CHAINNAME_LENGTH];
-    char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                  : CHAINPREFIX_HOST_OUT_TEMP;
+    char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                : CHAINPREFIX_HOST_OUT_TEMP;
 
     PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -2895,9 +2895,9 @@ ebtablesLinkTmpRootChain(virBufferPtr buf,
                          int stopOnError)
 {
     char chain[MAX_CHAINNAME_LENGTH];
-    char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                  : CHAINPREFIX_HOST_OUT_TEMP;
-    char iodev = (incoming) ? 'i' : 'o';
+    char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                : CHAINPREFIX_HOST_OUT_TEMP;
+    char iodev = incoming ? 'i' : 'o';
 
     PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -2905,8 +2905,8 @@ ebtablesLinkTmpRootChain(virBufferPtr buf,
                       CMD_DEF("$EBT -t nat -A %s -%c %s -j %s") CMD_SEPARATOR
                       CMD_EXEC
                       "%s",
-                      (incoming) ? EBTABLES_CHAIN_INCOMING
-                                 : EBTABLES_CHAIN_OUTGOING,
+                      incoming ? EBTABLES_CHAIN_INCOMING
+                               : EBTABLES_CHAIN_OUTGOING,
                       iodev, ifname, chain,
 
                       CMD_STOPONERR(stopOnError));
@@ -2923,11 +2923,11 @@ _ebtablesRemoveRootChain(virBufferPtr buf,
     char chain[MAX_CHAINNAME_LENGTH];
     char chainPrefix;
     if (isTempChain)
-        chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                 : CHAINPREFIX_HOST_OUT_TEMP;
+        chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                               : CHAINPREFIX_HOST_OUT_TEMP;
     else
-        chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN
-                                 : CHAINPREFIX_HOST_OUT;
+        chainPrefix = incoming ? CHAINPREFIX_HOST_IN
+                               : CHAINPREFIX_HOST_OUT;
 
     PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
@@ -2963,23 +2963,23 @@ _ebtablesUnlinkRootChain(virBufferPtr buf,
                          int isTempChain)
 {
     char chain[MAX_CHAINNAME_LENGTH];
-    char iodev = (incoming) ? 'i' : 'o';
+    char iodev = incoming ? 'i' : 'o';
     char chainPrefix;
 
     if (isTempChain) {
-        chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                 : CHAINPREFIX_HOST_OUT_TEMP;
+        chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                               : CHAINPREFIX_HOST_OUT_TEMP;
     } else {
-        chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN
-                                 : CHAINPREFIX_HOST_OUT;
+        chainPrefix = incoming ? CHAINPREFIX_HOST_IN
+                               : CHAINPREFIX_HOST_OUT;
     }
 
     PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
 
     virBufferAsprintf(buf,
                       "$EBT -t nat -D %s -%c %s -j %s" CMD_SEPARATOR,
-                      (incoming) ? EBTABLES_CHAIN_INCOMING
-                                 : EBTABLES_CHAIN_OUTGOING,
+                      incoming ? EBTABLES_CHAIN_INCOMING
+                               : EBTABLES_CHAIN_OUTGOING,
                       iodev, ifname, chain);
 
     return 0;
@@ -3016,8 +3016,8 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
     ebiptablesRuleInstPtr tmp = *inst;
     size_t count = *nRuleInstances;
     char rootchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
-    char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                  : CHAINPREFIX_HOST_OUT_TEMP;
+    char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                : CHAINPREFIX_HOST_OUT_TEMP;
     char *protostr = NULL;
 
     PRINT_ROOT_CHAIN(rootchain, chainPrefix, ifname);
@@ -3150,10 +3150,10 @@ ebtablesRenameTmpSubChain(virBufferPtr buf,
                           const char *protocol)
 {
     char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
-    char tmpChainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP
-                                     : CHAINPREFIX_HOST_OUT_TEMP;
-    char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN
-                                  : CHAINPREFIX_HOST_OUT;
+    char tmpChainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
+                                   : CHAINPREFIX_HOST_OUT_TEMP;
+    char chainPrefix = incoming ? CHAINPREFIX_HOST_IN
+                                : CHAINPREFIX_HOST_OUT;
 
     if (protocol) {
         PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
-- 
1.8.5.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]