[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090520113740.GA6546@ff.dom.local>
Date: Wed, 20 May 2009 11:37:40 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: David Miller <davem@...emloft.net>, nhorman@...driver.com,
lav@....ru, shemminger@...ux-foundation.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: fix rtable leak in net/ipv4/route.c
On Wed, May 20, 2009 at 01:13:41PM +0200, Eric Dumazet wrote:
> Jarek Poplawski a écrit :
> > On Wed, May 20, 2009 at 08:14:28AM +0200, Eric Dumazet wrote:
> >> + for (aux = rt_hash_table[i].chain;;) {
> >> + if (aux == rth) {
> >> + length += ONE;
> >> + break;
> >> + }
> >> + if (compare_hash_inputs(&aux->fl, &rth->fl))
> >> + break;
> >> + aux = aux->u.dst.rt_next;
> >> + }
> >
> > Very "interesting" for() usage, but isn't it more readable like this?:
> >
> > aux = rt_hash_table[i].chain;
> > while (aux != rth) {
> > if (compare_hash_inputs(&aux->fl, &rth->fl))
> > break;
> > aux = aux->u.dst.rt_next;
> > }
>
> well, this test is done two times, this is the difference...
I know, but I guess this is used quite often. And probably it's not
very hard optimization for a compiler (while - else). As a matter of
fact even this would confuse me less here:
aux = rt_hash_table[i].chain;
for (;;) {
But of course, it's a matter of taste, so no big deal.
Jarek P.
--
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