mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Andreas Schwab <schwab@suse.de>
Cc: Andrew Morton <akpm@digeo.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hlist_for_each_safe cleanup
Date: Fri, 23 Jul 2004 15:56:14 -0700	[thread overview]
Message-ID: <20040723155614.2a63dc71@dell_ss3.pdx.osdl.net> (raw)
In-Reply-To: <jeoem65shc.fsf@sykes.suse.de>

On Fri, 23 Jul 2004 23:22:23 +0200
Andreas Schwab <schwab@suse.de> wrote:

> Stephen Hemminger <shemminger@osdl.org> writes:
> 
> > --- linux-2.6/include/linux/list.h	2004-07-23 09:36:18.000000000 -0700
> > +++ tcp-2.6/include/linux/list.h	2004-07-23 11:43:25.000000000 -0700
> > @@ -620,13 +620,12 @@
> >  
> >  #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
> >  
> > -/* Cannot easily do prefetch unfortunately */
> >  #define hlist_for_each(pos, head) \
> >  	for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
> >  	     pos = pos->next)
> >  
> >  #define hlist_for_each_safe(pos, n, head) \
> > -	for (pos = (head)->first; n = pos ? pos->next : NULL, pos; \
> > +	for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
> 
> What's wrong with using the comma operator instead of non-standard
> statement expressions?

It was more a case of consistency and avoiding the n = NULL assignment when pos
is NULL.  

Look at hlist_for_each_entry_safe

#define hlist_for_each_entry_safe(tpos, pos, n, head, member)            \
        for (pos = (head)->first;                                        \
             pos && ({ n = pos->next; 1; }) &&                           \
                ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
             pos = n)


What's your problem with the gcc extensions, the kernel uses them all over the place,
planning on starting a conversion?


  reply	other threads:[~2004-07-23 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-23 21:05 Stephen Hemminger
2004-07-23 21:22 ` Andreas Schwab
2004-07-23 22:56   ` Stephen Hemminger [this message]
2004-07-23 23:13     ` Andreas Schwab
2004-07-25  9:32     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040723155614.2a63dc71@dell_ss3.pdx.osdl.net \
    --to=shemminger@osdl.org \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®