[ovs-dev] [threads 16/17] netdev-vport: Make netdev_vport_get_dpif_port() code less confusing.

Pravin Shelar pshelar at nicira.com
Fri Jun 7 21:07:09 UTC 2013


On Wed, Jun 5, 2013 at 1:05 PM, Ben Pfaff <blp at nicira.com> wrote:
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/netdev-vport.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 3558f43..4bb41bd 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -123,8 +123,6 @@ netdev_vport_class_get_dpif_port(const struct netdev_class *class)
>  const char *
>  netdev_vport_get_dpif_port(const struct netdev *netdev)
>  {
> -    const char *dpif_port;
> -
>      if (netdev_vport_needs_dst_port(netdev)) {
>          const struct netdev_vport *vport = netdev_vport_cast(netdev);
>          const char *type = netdev_get_type(netdev);
> @@ -142,10 +140,9 @@ netdev_vport_get_dpif_port(const struct netdev *netdev)
>          return dpif_port_combined;
>      } else {
>          const struct netdev_class *class = netdev_get_class(netdev);
> -        dpif_port = netdev_vport_class_get_dpif_port(class);
> +        const char *dpif_port = netdev_vport_class_get_dpif_port(class);
> +        return dpif_port ? dpif_port : netdev_get_name(netdev);
>      }
> -
> -    return dpif_port ? dpif_port : netdev_get_name(netdev);
>  }
>

Looks good.

Thanks.



More information about the dev mailing list