[ovs-dev] [PATCH] ovn-sbctl: Avoid cast in lflow_cmp().

Ben Pfaff blp at nicira.com
Wed Aug 19 19:11:42 UTC 2015


Using casts, IMO, makes it harder to spot what's actually going on.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ovn/utilities/ovn-sbctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index c69800a..fc522b3 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -626,10 +626,10 @@ pipeline_encode(const char *pl)
 static int
 lflow_cmp(const void *lf1_, const void *lf2_)
 {
-    const struct sbrec_logical_flow *lf1, *lf2;
-
-    lf1 = *((struct sbrec_logical_flow **) lf1_);
-    lf2 = *((struct sbrec_logical_flow **) lf2_);
+    const struct sbrec_logical_flow *const *lf1p = lf1_;
+    const struct sbrec_logical_flow *const *lf2p = lf2_;
+    const struct sbrec_logical_flow *lf1 = *lf1p;
+    const struct sbrec_logical_flow *lf2 = *lf2p;
 
     int pl1 = pipeline_encode(lf1->pipeline);
     int pl2 = pipeline_encode(lf2->pipeline);
-- 
2.1.3




More information about the dev mailing list