[ovs-dev] [PATCH 3/6] odp-util: Rewrite odp_mask_attr_is_exact().

Ben Pfaff blp at ovn.org
Mon Jul 31 20:02:23 UTC 2017


The way this function was written seemed really funny to me, so this commit
rewrites it.  There should be no behavioral change.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/odp-util.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index f7a2d8457386..7f3630d6e718 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -2230,17 +2230,8 @@ static bool
 odp_mask_attr_is_exact(const struct nlattr *ma)
 {
     enum ovs_key_attr attr = nl_attr_type(ma);
-    const void *mask;
-    size_t size;
-
-    if (attr == OVS_KEY_ATTR_TUNNEL) {
-        return false;
-    } else {
-        mask = nl_attr_get(ma);
-        size = nl_attr_get_size(ma);
-    }
-
-    return odp_mask_is_exact(attr, mask, size);
+    return (attr != OVS_KEY_ATTR_TUNNEL
+            && odp_mask_is_exact(attr, nl_attr_get(ma), nl_attr_get_size(ma)));
 }
 
 void
-- 
2.10.2



More information about the dev mailing list