Eggdev: Re: [cvslog] (2007-05-09 01:32:43 UTC) Module eggdrop1.9: Change committed!

Bryan Drewery bryan at shatow.net
Tue May 8 20:01:57 CST 2007


Well you could design some sort of iterator into the hash functions
instead of using the walk functions

hash_iterator_t iter;
for (iter = users->iter; iter.valid(); iter.next()) {
  char *key = (char*) iter.key();
  char *value = (char*) iter.value();
}

Sven Trenkel wrote:
> Wow, that was fast!
>
> Bryan Drewery wrote:
>   
>> This is what the hash table walk functions are for..
>> You could even design an iterator for an inplace for loop on the hash
>> table..
>>     
>
> You're right, it might be a little more complicated for functions that
> do something with a user based on the other users, but the resulting
> code might even be cleaner than the whole going-along-the-list stuff. It
> just requires an additional function to allow functions from outside of
> user.c to iterate the list. I'll change it in the next commit.
>
> CU
>    Sven
>   


-- 
Bryan






More information about the Eggdev mailing list