[Mesa-dev] [PATCH 2/3] util: Add list_is_single() helper function
Eduardo Lima Mitev
elima at igalia.com
Fri Oct 23 11:13:26 PDT 2015
On 10/23/2015 08:00 PM, Jason Ekstrand wrote:
> On Fri, Oct 23, 2015 at 10:51 AM, Matt Turner <mattst88 at gmail.com> wrote:
>> On Fri, Oct 23, 2015 at 8:55 AM, Eduardo Lima Mitev <elima at igalia.com> wrote:
>>> Returns true is the list has exactly one element, otherwise returns false.
>>> ---
>>> src/util/list.h | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/src/util/list.h b/src/util/list.h
>>> index b98ce59..2b03461 100644
>>> --- a/src/util/list.h
>>> +++ b/src/util/list.h
>>> @@ -99,6 +99,14 @@ static inline bool list_empty(struct list_head *list)
>>> return list->next == list;
>>> }
>>>
>>> +/**
>>> + * Return true is the list has exactly one element, otherwise return false.
>>
>> How about "Returns whether the list has exactly one element."
>>
>>> + */
>>> +static inline bool list_is_single(struct list_head *list)
>
> The kernel list calls this list_is_singular. We've tried to keep
> things similar, so it would be good to use the kernel list name.
>
Ok, will rename it locally to 'list_is_singular'.
>>
>> Doesn't look like anywhere else uses const arguments, but this could
>> be. No matter...
>
> Yeah, const would be good.
>
Added it locally already.
Eduardo
>>> +{
>>> + return list->next != NULL && list->next->next == list;
>>> +}
>>> +
>>
>> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list