Remove pointless brackets around boolean

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@redhat.com>
This commit is contained in:
Daniel P. Berrange 2014-03-14 13:24:28 +00:00
parent 7f66afceda
commit 6c582bb9c6

View File

@ -650,7 +650,7 @@ iptablesCreateTmpRootChain(virBufferPtr buf,
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char chainPrefix[2] = { char chainPrefix[2] = {
prefix, prefix,
(incoming) ? CHAINPREFIX_HOST_IN_TEMP incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP : CHAINPREFIX_HOST_OUT_TEMP
}; };
@ -690,10 +690,10 @@ _iptablesRemoveRootChain(virBufferPtr buf,
}; };
if (isTempChain) if (isTempChain)
chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN_TEMP chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
else else
chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT; : CHAINPREFIX_HOST_OUT;
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -761,10 +761,10 @@ iptablesLinkTmpRootChain(virBufferPtr buf,
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char chainPrefix[2] = { char chainPrefix[2] = {
prefix, prefix,
(incoming) ? CHAINPREFIX_HOST_IN_TEMP incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP : CHAINPREFIX_HOST_OUT_TEMP
}; };
const char *match = (incoming) ? MATCH_PHYSDEV_IN const char *match = incoming ? MATCH_PHYSDEV_IN
: MATCH_PHYSDEV_OUT; : MATCH_PHYSDEV_OUT;
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -841,14 +841,14 @@ _iptablesUnlinkRootChain(virBufferPtr buf,
prefix, prefix,
}; };
if (isTempChain) if (isTempChain)
chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN_TEMP chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
else else
chainPrefix[1] = (incoming) ? CHAINPREFIX_HOST_IN chainPrefix[1] = incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT; : CHAINPREFIX_HOST_OUT;
const char *match = (incoming) ? MATCH_PHYSDEV_IN const char *match = incoming ? MATCH_PHYSDEV_IN
: MATCH_PHYSDEV_OUT; : MATCH_PHYSDEV_OUT;
const char *old_match = (incoming) ? NULL const char *old_match = incoming ? NULL
: MATCH_PHYSDEV_OUT_OLD; : MATCH_PHYSDEV_OUT_OLD;
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -929,12 +929,12 @@ iptablesRenameTmpRootChain(virBufferPtr buf,
char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH]; char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
char tmpChainPrefix[2] = { char tmpChainPrefix[2] = {
prefix, prefix,
(incoming) ? CHAINPREFIX_HOST_IN_TEMP incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP : CHAINPREFIX_HOST_OUT_TEMP
}; };
char chainPrefix[2] = { char chainPrefix[2] = {
prefix, prefix,
(incoming) ? CHAINPREFIX_HOST_IN incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT : CHAINPREFIX_HOST_OUT
}; };
@ -2875,7 +2875,7 @@ ebtablesCreateTmpRootChain(virBufferPtr buf,
int stopOnError) int stopOnError)
{ {
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -2897,9 +2897,9 @@ ebtablesLinkTmpRootChain(virBufferPtr buf,
int stopOnError) int stopOnError)
{ {
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
char iodev = (incoming) ? 'i' : 'o'; char iodev = incoming ? 'i' : 'o';
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -2907,7 +2907,7 @@ ebtablesLinkTmpRootChain(virBufferPtr buf,
CMD_DEF("$EBT -t nat -A %s -%c %s -j %s") CMD_SEPARATOR CMD_DEF("$EBT -t nat -A %s -%c %s -j %s") CMD_SEPARATOR
CMD_EXEC CMD_EXEC
"%s", "%s",
(incoming) ? EBTABLES_CHAIN_INCOMING incoming ? EBTABLES_CHAIN_INCOMING
: EBTABLES_CHAIN_OUTGOING, : EBTABLES_CHAIN_OUTGOING,
iodev, ifname, chain, iodev, ifname, chain,
@ -2925,10 +2925,10 @@ _ebtablesRemoveRootChain(virBufferPtr buf,
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char chainPrefix; char chainPrefix;
if (isTempChain) if (isTempChain)
chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
else else
chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN chainPrefix = incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT; : CHAINPREFIX_HOST_OUT;
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
@ -2965,14 +2965,14 @@ _ebtablesUnlinkRootChain(virBufferPtr buf,
int isTempChain) int isTempChain)
{ {
char chain[MAX_CHAINNAME_LENGTH]; char chain[MAX_CHAINNAME_LENGTH];
char iodev = (incoming) ? 'i' : 'o'; char iodev = incoming ? 'i' : 'o';
char chainPrefix; char chainPrefix;
if (isTempChain) { if (isTempChain) {
chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
} else { } else {
chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN chainPrefix = incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT; : CHAINPREFIX_HOST_OUT;
} }
@ -2980,7 +2980,7 @@ _ebtablesUnlinkRootChain(virBufferPtr buf,
virBufferAsprintf(buf, virBufferAsprintf(buf,
"$EBT -t nat -D %s -%c %s -j %s" CMD_SEPARATOR, "$EBT -t nat -D %s -%c %s -j %s" CMD_SEPARATOR,
(incoming) ? EBTABLES_CHAIN_INCOMING incoming ? EBTABLES_CHAIN_INCOMING
: EBTABLES_CHAIN_OUTGOING, : EBTABLES_CHAIN_OUTGOING,
iodev, ifname, chain); iodev, ifname, chain);
@ -3018,7 +3018,7 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
ebiptablesRuleInstPtr tmp = *inst; ebiptablesRuleInstPtr tmp = *inst;
size_t count = *nRuleInstances; size_t count = *nRuleInstances;
char rootchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH]; char rootchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP char chainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
char *protostr = NULL; char *protostr = NULL;
@ -3152,9 +3152,9 @@ ebtablesRenameTmpSubChain(virBufferPtr buf,
const char *protocol) const char *protocol)
{ {
char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH]; char tmpchain[MAX_CHAINNAME_LENGTH], chain[MAX_CHAINNAME_LENGTH];
char tmpChainPrefix = (incoming) ? CHAINPREFIX_HOST_IN_TEMP char tmpChainPrefix = incoming ? CHAINPREFIX_HOST_IN_TEMP
: CHAINPREFIX_HOST_OUT_TEMP; : CHAINPREFIX_HOST_OUT_TEMP;
char chainPrefix = (incoming) ? CHAINPREFIX_HOST_IN char chainPrefix = incoming ? CHAINPREFIX_HOST_IN
: CHAINPREFIX_HOST_OUT; : CHAINPREFIX_HOST_OUT;
if (protocol) { if (protocol) {