[ovs-dev] [cleanups 07/13] ofproto: Don't bother returning value from facet_make_actions().

Ethan Jackson ethan at nicira.com
Fri Nov 12 21:46:33 UTC 2010


Looks good.

On Fri, Oct 29, 2010 at 4:37 PM, Ben Pfaff <blp at nicira.com> wrote:
> None of the remaining callers use the return value.
> ---
>  ofproto/ofproto.c |   22 +++++++++-------------
>  1 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 522486c..78ae650 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -180,8 +180,8 @@ static void facet_install(struct ofproto *, struct facet *, bool zero_stats);
>  static void facet_uninstall(struct ofproto *, struct facet *);
>  static void facet_flush_stats(struct ofproto *, struct facet *);
>
> -static bool facet_make_actions(struct ofproto *, struct facet *,
> -                              const struct ofpbuf *packet);
> +static void facet_make_actions(struct ofproto *, struct facet *,
> +                               const struct ofpbuf *packet);
>  static void facet_update_stats(struct ofproto *, struct facet *,
>                                const struct odp_flow_stats *);
>
> @@ -2156,9 +2156,8 @@ facet_remove(struct ofproto *ofproto, struct facet *facet)
>     facet_free(facet);
>  }
>
> -/* Composes the ODP actions for 'facet' based on its rule's actions.
> - * Returns true if the actions changed, false otherwise. */
> -static bool
> +/* Composes the ODP actions for 'facet' based on its rule's actions. */
> +static void
>  facet_make_actions(struct ofproto *p, struct facet *facet,
>                    const struct ofpbuf *packet)
>  {
> @@ -2171,15 +2170,12 @@ facet_make_actions(struct ofproto *p, struct facet *facet,
>                   &facet->nf_flow.output_iface);
>
>     actions_len = a.n_actions * sizeof *a.actions;
> -    if (facet->n_actions == a.n_actions
> -        && !memcmp(facet->actions, a.actions, actions_len)) {
> -        return false;
> +    if (facet->n_actions != a.n_actions
> +        || memcmp(facet->actions, a.actions, actions_len)) {
> +        free(facet->actions);
> +        facet->n_actions = a.n_actions;
> +        facet->actions = xmemdup(a.actions, actions_len);
>     }
> -
> -    free(facet->actions);
> -    facet->n_actions = a.n_actions;
> -    facet->actions = xmemdup(a.actions, actions_len);
> -    return true;
>  }
>
>  static int
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>




More information about the dev mailing list