On 7/26/17 9:22 AM, Jeff Mahoney wrote:
> On 7/26/17 3:08 AM, Nikolay Borisov wrote:
>>
>>
>> On 25.07.2017 23:51, jeffm@xxxxxxxx wrote:
>>> From: Jeff Mahoney <jeffm@xxxxxxxx>
>>>
>>> ---
>>> backref.c | 11 +++++++----
>>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/backref.c b/backref.c
>>> index ac1b506..be3376a 100644
>>> --- a/backref.c
>>> +++ b/backref.c
>>> @@ -130,6 +130,11 @@ struct __prelim_ref {
>>> u64 wanted_disk_byte;
>>> };
>>>
>>> +static struct __prelim_ref *list_first_pref(struct list_head *head)
>>> +{
>>> + return list_first_entry(head, struct __prelim_ref, list);
>>> +}
>>> +
>>
>> I think this just adds one more level of abstraction with no real
>> benefit whatsoever. Why not drop the patch entirely.
>
> Ack. I thought it might be more readable but it ends up taking the same
> number of characters.
Actually, no, it doesn't. That's only true if using 'head' as the list head
as in the helper.
It ends up being
ref = list_first_pref(&prefstate->pending_missing_keys);
vs
ref = list_first_entry(&prefstate->pending_missing_keys,
struct __prelim_ref, list);
and I have to say I prefer reading the former.
-Jeff
--
Jeff Mahoney
SUSE Labs
Attachment:
signature.asc
Description: OpenPGP digital signature
