You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2002/05/24 16:41:08 UTC
cvs commit: httpd-2.0/modules/experimental cache_hash.c cache_hash.h mod_mem_cache.c
stoddard 02/05/24 07:41:08
Modified: modules/experimental cache_hash.c cache_hash.h
mod_mem_cache.c
Log:
Expose a new cache_hash function to free the hash table.
Revision Changes Path
1.6 +9 -0 httpd-2.0/modules/experimental/cache_hash.c
Index: cache_hash.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_hash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cache_hash.c 10 May 2002 17:15:35 -0000 1.5
+++ cache_hash.c 24 May 2002 14:41:08 -0000 1.6
@@ -139,6 +139,15 @@
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.
*/
1.5 +11 -0 httpd-2.0/modules/experimental/cache_hash.h
Index: cache_hash.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_hash.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- cache_hash.h 6 May 2002 01:10:24 -0000 1.4
+++ cache_hash.h 24 May 2002 14:41:08 -0000 1.5
@@ -105,6 +105,17 @@
*/
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.
1.60 +3 -0 httpd-2.0/modules/experimental/mod_mem_cache.c
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- mod_mem_cache.c 17 May 2002 11:33:09 -0000 1.59
+++ mod_mem_cache.c 24 May 2002 14:41:08 -0000 1.60
@@ -268,6 +268,9 @@
}
}
+ /* Cache is empty, free the cache table */
+ cache_hash_free(co->cacheht);
+
if (sconf->lock) {
apr_thread_mutex_unlock(sconf->lock);
}