Hi,

This is the apr_hash on steroids :)

It enables to do 'worker' things like:

static int lwr_worker( const void **key, apr_ssize_t klen, void **val)
{
        if (!key)
        return -1;
        *val = strlwr(*val);
        return 0;
}
...

apr_hlist_walk(list, lwr_worker);

or sorting:

static int sort_icase(apr_hlist_entry_t *a, apr_hlist_entry_t *b)
{
        const void *n1, *n2;
        apr_ssize_t  l1, l2;
        apr_hlist_entry(a, &n1, &l1, NULL);
        apr_hlist_entry(b, &n2, &l2, NULL);
        return strnicmp(n1, n2, l1 < l2 ? l1 : l2);
}
...
/* now sort the list */
apr_hlist_sort(list, sort_icase);

Don't now if anyone would find it usefull, but here it is :)

MT.

Attachment: apr_hlist.h
Description: Binary data

Attachment: apr_hlist.c
Description: Binary data

Reply via email to