]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: transform logic in virNWFilterRuleInstSort to eliminate label
authorLaine Stump <laine@redhat.com>
Thu, 25 Jun 2020 02:30:38 +0000 (22:30 -0400)
committerLaine Stump <laine@redhat.com>
Mon, 20 Jul 2020 23:13:22 +0000 (19:13 -0400)
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>
src/nwfilter/nwfilter_ebiptables_driver.c

index cc0f3f93d94d5a67dc4b4bdbfc602797ef444db4..94eaac927a94bfacc345a72d988856b8310bdba2 100644 (file)
@@ -3113,13 +3113,12 @@ virNWFilterRuleInstSort(const void *a, const void *b)
     /* ensure root chain commands appear before all others since
        we will need them to create the child chains */
     if (root_a) {
-        if (root_b)
-            goto normal;
-        return -1; /* a before b */
-    }
-    if (root_b)
+        if (!root_b)
+            return -1; /* a before b */
+    } else if (root_b) {
         return 1; /* b before a */
- normal:
+    }
+
     /* priorities are limited to range [-1000, 1000] */
     return insta->priority - instb->priority;
 }