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

Russell Bryant rbryant at redhat.com
Wed Aug 19 20:17:10 UTC 2015


On 08/19/2015 12:11 PM, Ben Pfaff wrote:
> 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);
> 

Sorry.  :-)

Acked-by: Russell Bryant <rbryant at redhat.com>

-- 
Russell Bryant



More information about the dev mailing list