Commit 062cbffe authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Expose a new cache_hash function to free the hash table.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95264 13f79535-47bb-0310-9956-ffa450edef68
parent a097a96f
Loading
Loading
Loading
Loading
+9 −0
Changes for modules/experimental/cache_hash.c: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -139,6 +139,15 @@ CACHE_DECLARE(cache_hash_t *) cache_hash_make(apr_size_t size)
    return ht;
}

CACHE_DECLARE(void) cache_hash_free(cache_hash_t *ht)
{
    if (ht) {
        if (ht->array) {
            free (ht->array);
        }
        free (ht);
    }
}
/*
 * Hash iteration functions.
 */
+11 −0
Changes for modules/experimental/cache_hash.h: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -105,6 +105,17 @@ typedef struct cache_hash_index_t cache_hash_index_t;
  */
CACHE_DECLARE(cache_hash_t *) cache_hash_make(apr_size_t size);

/**
 * Create a hash table.
 * @param *ht Pointer to the hash table to be freed.
 * @return void
 * @remark The caller should ensure that all objects have been removed
 *         from the cache prior to calling cache_hash_free(). Objects 
 *         not removed from the cache prior to calling cache_hash_free()
 *         will be unaccessable.
 */
CACHE_DECLARE(void) cache_hash_free(cache_hash_t *ht);


/**
 * Associate a value with a key in a hash table.
+3 −0
Changes for modules/experimental/mod_mem_cache.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -268,6 +268,9 @@ static apr_status_t cleanup_cache_mem(void *sconfv)
        }
    }

    /* Cache is empty, free the cache table */        
    cache_hash_free(co->cacheht);

    if (sconf->lock) {
        apr_thread_mutex_unlock(sconf->lock);
    }