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:09:50 CST 2007


Sorry, I fell into c++ here.. you'd have to do like

iter = hash_table_iter(users)
hash_table_iter_valid(iter)
iter = hash_table_iter_next(iter)
hash_table_iter_key(iter)
hash_table_iter_value(iter)

.... shrug... it might be too ugly .. but you could avoid the walking at
least

Bryan Drewery wrote:
> 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