include/apr_hash.h

Start iterating over the entries in a hash table.
Parameters:
p The pool to allocate the apr_hash_index_t iterator. If this pool is NULL, then an internal, non-thread-safe iterator is used.
ht The hash table
Remarks:
There is no restriction on adding or deleting hash entries during an iteration (although the results may be unpredictable unless all you do is delete the current entry) and multiple iterations can be in progress at the same time.

 int sum_values(apr_pool_t *p, apr_hash_t *ht)
 {
     apr_hash_index_t *hi;
     void *val;
     int sum = 0;
     for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
         apr_hash_this(hi, NULL, NULL, &val);
         sum += *(int *)val;
     }
     return sum;
 }
 


Generated on Sat Aug 16 19:13:40 2008 for Apache Portable Runtime by  doxygen 1.5.6