mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
nwfilter: transform logic in virNWFilterRuleInstSort to eliminate label
This rewrite of a nested conditional produces the same results, but eliminate a goto and corresponding label. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ad668b98e9
commit
9c5cd04545
@ -3113,13 +3113,12 @@ virNWFilterRuleInstSort(const void *a, const void *b)
|
|||||||
/* ensure root chain commands appear before all others since
|
/* ensure root chain commands appear before all others since
|
||||||
we will need them to create the child chains */
|
we will need them to create the child chains */
|
||||||
if (root_a) {
|
if (root_a) {
|
||||||
if (root_b)
|
if (!root_b)
|
||||||
goto normal;
|
return -1; /* a before b */
|
||||||
return -1; /* a before b */
|
} else if (root_b) {
|
||||||
}
|
|
||||||
if (root_b)
|
|
||||||
return 1; /* b before a */
|
return 1; /* b before a */
|
||||||
normal:
|
}
|
||||||
|
|
||||||
/* priorities are limited to range [-1000, 1000] */
|
/* priorities are limited to range [-1000, 1000] */
|
||||||
return insta->priority - instb->priority;
|
return insta->priority - instb->priority;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user