mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
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:
parent
7f66afceda
commit
6c582bb9c6
@ -650,8 +650,8 @@ 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
|
||||||
};
|
};
|
||||||
|
|
||||||
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||||
@ -690,11 +690,11 @@ _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,11 +761,11 @@ 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,15 +841,15 @@ _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,13 +929,13 @@ 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
|
||||||
};
|
};
|
||||||
|
|
||||||
PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
||||||
@ -2875,8 +2875,8 @@ 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,8 +2907,8 @@ 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,
|
||||||
|
|
||||||
CMD_STOPONERR(stopOnError));
|
CMD_STOPONERR(stopOnError));
|
||||||
@ -2925,11 +2925,11 @@ _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,23 +2965,23 @@ _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;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3018,8 +3018,8 @@ 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;
|
||||||
|
|
||||||
PRINT_ROOT_CHAIN(rootchain, chainPrefix, ifname);
|
PRINT_ROOT_CHAIN(rootchain, chainPrefix, ifname);
|
||||||
@ -3152,10 +3152,10 @@ 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) {
|
||||||
PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
|
PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
|
||||||
|
Loading…
Reference in New Issue
Block a user