Hunter的大杂烩 技术学习笔记

2007-04-19

patch for apache 2.0.59

Filed under: C++,Linux — hunter @ 4:01 pm

httpd-2.0.59/srclib/apr/tables/apr_tables.c

 

 /*////////////////////////////////////add by hunter */
APR_DECLARE(const char *) apr_table_get_all(const apr_table_t *t, const char *key, int *offset)
{
    apr_table_entry_t *next_elt;
    apr_table_entry_t *end_elt;
    apr_uint32_t checksum;
    int hash, tmp_offset = 0;

    if (key == NULL) {
                return NULL;
    }

    hash = TABLE_HASH(key);
    if (!TABLE_INDEX_IS_INITIALIZED(t, hash)) {
        return NULL;
    }
    COMPUTE_KEY_CHECKSUM(key, checksum);
    next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash] ;
    end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash];

    for (; next_elt < = end_elt; next_elt++) {                 if ((checksum == next_elt->key_checksum) &&
                         !strcasecmp(next_elt->key, key)) {
                                if (tmp_offset >= *offset){
                                   *offset = tmp_offset;
                                        return next_elt->val;
                                }
                                tmp_offset++;
                }
    }

    return NULL;
}

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress