lkml.org 
[lkml]   [2022]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] list: always set pos in list_prepare_entry()
On Sun, Mar 06, 2022 at 05:26:35PM +0100, Jakob Koschel wrote:
> In order to assign the result from list_prepare_entry() to another
> variable, it should also be set when pos != NULL.
>
> This will be useful once the list iterator is no longer used after
> the loop.

...

> #define list_prepare_entry(pos, head, member) \
> - ((pos) ? : list_entry(head, typeof(*pos), member))
> + ((pos) ? pos : list_entry(head, typeof(*pos), member))

I'm not sure why then we have () surrounding first pos.

Am I right that the original is an equivalent to

((pos) ? (pos) : list_entry(head, typeof(*pos), member))

?

Then what the difference is made by not using parentheses?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-03-07 11:22    [W:0.059 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site