2002-10-04 13:47:42

by Mark Peloquin

[permalink] [raw]
Subject: Re: [Evms-devel] Re: [PATCH] EVMS core 2/4: evms.h


On 10/04/2002 at 7:28 AM, Robert Varga wrote:
<snip...>
> Possibly shortened to:

> static inline int list_member(struct list_head *member)
> {
> return member->next && member->prev;
> }

> Faster, and (at least to me) it looks more obvious.

Yes, this may be shorter. However with this change
the return type would also need to be changed to
portable across archs.

Mark



2002-10-04 14:31:07

by Kevin Corry

[permalink] [raw]
Subject: Re: [PATCH] EVMS core 2/4: evms.h

On Friday 04 October 2002 08:59, Mark Peloquin wrote:
> On 10/04/2002 at 7:28 AM, Robert Varga wrote:
> <snip...>
>
> > Possibly shortened to:
> >
> > static inline int list_member(struct list_head *member)
> > {
> > return member->next && member->prev;
> > }
> >
> > Faster, and (at least to me) it looks more obvious.
>
> Yes, this may be shorter. However with this change
> the return type would also need to be changed to
> portable across archs.

What would the return type have to be?

--
Kevin Corry
[email protected]
http://evms.sourceforge.net/

2002-10-04 15:12:14

by Kevin Corry

[permalink] [raw]
Subject: Re: [PATCH] EVMS core 2/4: evms.h

On Friday 04 October 2002 09:03, Kevin Corry wrote:
> On Friday 04 October 2002 08:59, Mark Peloquin wrote:
> > On 10/04/2002 at 7:28 AM, Robert Varga wrote:
> > <snip...>
> >
> > > Possibly shortened to:
> > >
> > > static inline int list_member(struct list_head *member)
> > > {
> > > return member->next && member->prev;
> > > }
> > >
> > > Faster, and (at least to me) it looks more obvious.
> >
> > Yes, this may be shorter. However with this change
> > the return type would also need to be changed to
> > portable across archs.
>
> What would the return type have to be?

Hmm...seemed to be a misunderstanding. The "&&" operator causes the
expression to evaluate to an int, and not to a list_head*. The above should
work fine.

--
Kevin Corry
[email protected]
http://evms.sourceforge.net/