Hi,

I wonder, why nobody answered yet.
Did I missed something?

My suggestions was to split "apr_hash_first()" into two parts/functions
1. allocating memory for the iterator
2. jumping to the first entry of the hash table.

e.g. (seen from the application):
--------------------
   apr_hash_index_t* hi1 ;
   apr_hash_index_t* hi2 ;
   apr_pool_t  p ;

   hi1 = apr_hash_alloc_iterator(p,ht) ;

   while (1) // an endless thread, which iterates through the hashtable
   {
     for ((hi2=apr_hash_first(hi1,ht); hi2; hi2=apr_hash_next(hi2))
     {
       apr_hash_this(...) ;
       ....
     }
   }
----------------------

if we make a definition within apr_hash.h, we could even use
static iterators like:
----------------------
   apr_hash_iterator_t  Iterator ;
   apr_hash_index_t     *hi ;

   for (hi=apr_hash_first(&Iterator,ht); hi; hi=apr_hash_next(hi))
   ....
-----------------------

Does this makes sense?

Gunter






Reply via email to