On Mon, Nov 7, 2011 at 9:16 AM, Ben Pfaff <b...@nicira.com> wrote:
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 197b2d0..00d6f36 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> +static void
> +format_ovs_key_attr_name(struct ds *ds, enum ovs_key_attr attr)
> +{
> +    const char *name = ovs_key_attr_to_string(attr);
> +    if (name != ovs_key_attr_unknown) {
> +        ds_put_cstr(ds, name);
> +    } else {
> +        ds_put_format(ds, "key%u", (unsigned int) attr);

It seems to me that maybe it's better to just always return key%u from
the original function, I don't know that we ever just want "unknown".

>  format_odp_pop_action(uint16_t type, struct ds *ds)
>  {
> -    if (type <= OVS_KEY_ATTR_MAX) {
> -        ds_put_format(ds, "pop(%s)", ovs_key_attr_to_string(type));
> -    } else {
> -        ds_put_format(ds, "pop(key%"PRIu16")", type);
> -    }
> +    ds_put_cstr(ds, "pop(");
> +    format_ovs_key_attr_name(ds, type);
> +    ds_put_char(ds, ')');

We probably can drop this down in the main function down since it's
pretty simple and is now the same as push/set.

> @@ -354,6 +364,7 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
>     const struct ovs_key_nd *nd_key;
>     enum ovs_key_attr attr = nl_attr_type(a);
>
> +    format_ovs_key_attr_name(ds, attr);
>     if (nl_attr_get_size(a) != odp_flow_key_attr_len(nl_attr_type(a))) {
>         ds_put_format(ds, "bad length %zu, expected %d for: ",
>                       nl_attr_get_size(a),

I think you now want a space between the type and "bad".
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to