[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B6FE6@saturn3.aculab.com>
Date: Mon, 10 Sep 2012 14:54:45 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Cong Wang" <amwang@...hat.com>, <netdev@...r.kernel.org>
Cc: "David S. Miller" <davem@...emloft.net>
Subject: RE: [PATCH 2/3] ipv6, route: remove BACKTRACK() macro
> Subject: [PATCH 2/3] ipv6, route: remove BACKTRACK() macro
>
> It doesn't save any code, nor it helps readability.
>
> Signed-off-by: Cong Wang <amwang@...hat.com>
> ---
> net/ipv6/route.c | 48 ++++++++++++++++++++++++++++--------------------
> 1 files changed, 28 insertions(+), 20 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index b130bf2..71267e9 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -675,24 +675,6 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
> }
> #endif
>
> -#define BACKTRACK(__net, saddr) \
> -do { \
> - if (rt == __net->ipv6.ip6_null_entry) { \
> - struct fib6_node *pn; \
> - while (1) { \
> - if (fn->fn_flags & RTN_TL_ROOT) \
> - goto out; \
> - pn = fn->parent; \
> - if (FIB6_SUBTREE(pn) && FIB6_SUBTREE(pn) != fn) \
> - fn = fib6_lookup(FIB6_SUBTREE(pn), NULL, saddr); \
> - else \
> - fn = pn; \
> - if (fn->fn_flags & RTN_RTINFO) \
> - goto restart; \
> - } \
> - } \
> -} while (0)
> -
It does, however, seem to avoid replicating some relatively complex logic.
OTOH goto out of a #define and hidden parameters (rt, fn ...) are not nice.
Maybe the 'while (1)' part can be an inline function?
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists