[Mesa-dev] [PATCH 1/3] mesa: add set support (stores a set of pointers)

Ian Romanick idr at freedesktop.org
Thu Dec 6 10:34:35 PST 2012


On 12/05/2012 03:28 PM, Justen, Jordan L wrote:
> On Wed, 2012-12-05 at 11:26 -0800, Ian Romanick wrote:
>> On 12/05/2012 07:32 AM, Brian Paul wrote:
>>> On 12/04/2012 04:55 PM, Jordan Justen wrote:
>>>> +/**
>>>> + * This function is an iterator over the hash table.
>>>> + *
>>>> + * Pass in NULL for the first entry, as in the start of a for loop.
>>>> Note that
>>>> + * an iteration over the table is O(table_size) not O(entries).
>>>> + */
>>>> +struct set_entry *
>>>> +_mesa_set_next_entry(struct set *ht, struct set_entry *entry)
>>>
>>> Should ht be const-qualified here too?
>>
>> Since the returned set_entry isn't const-qualified, probably not.  I
>> think the compiler will generate an error.
>
> I added const to ht, and it is still building for me. (GCC 4.7)
>
> I plan to push this series with Brian's feedback. Or, do
> you suspect different compilers might take issue with it?

It doesn't generate any warnings or anything?  Eventually you're 
generating a non-const pointer from something const, so it sure seems 
like it should complain.  If it doesn't, I'm always fine with adding 
more const.



More information about the mesa-dev mailing list