Re: g_hash_table_get_keys()/g_hash_table_get_values()



Federico Mena Quintero <federico@helixcode.com> writes: 
> I think this is gratuitous sugar.
>

I'm using it a couple times in my new GTK patches anyway, so it's not
going to add any bloat.
 
> Sometimes you want a GSList, sometimes a GList, sometimes an array;
> sometimes you want to stash things in a tree. 

Sometimes, but usually a GSList is fine.

>  And most of the time
> you want both the key and the value, not just one of them.
>

I disagree, I rarely want both. Usually I do something like:
 g_hash_table_insert (table, foo->key, foo);
 
> I think the foreach() is fine.
> 

It's fine, but judicious sugar is good. I've used this function enough
times that I don't think it's overboard.

Havoc






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]