wrowe 01/08/01 17:03:44
Modified: include apr_hash.h
tables apr_hash.c
Log:
Quell a slow leak. The iterator's allocation is NOT pertinant to the hash!
Revision Changes Path
1.28 +5 -4 apr/include/apr_hash.h
Index: apr_hash.h
===================================================================
RCS file: /home/cvs/apr/include/apr_hash.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- apr_hash.h 2001/08/01 23:22:47 1.27
+++ apr_hash.h 2001/08/02 00:03:44 1.28
@@ -126,17 +126,18 @@
/**
* Start iterating over the entries in a hash table.
+ * @param p The pool to allocate the apr_hash_index_t iterator
* @param ht The hash table
* @return a pointer to the iteration state, or NULL if there are no entries.
* @tip Example:
* <PRE>
*
- * int sum_values(apr_hash_t *ht)
+ * 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(ht); hi; hi = apr_hash_next(hi)) {
+ * for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
* apr_hash_this(hi, NULL, NULL, &val);
* sum += *(int *)val;
* }
@@ -148,9 +149,9 @@
* is delete the current entry) and multiple iterations can be in
* progress at the same time.
* </PRE>
- * @deffunc apr_hash_index_t *apr_hash_first(apr_hash_t *ht)
+ * @deffunc apr_hash_index_t *apr_hash_first(apr_pool_t *p, apr_hash_t *ht)
*/
-APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_hash_t *ht);
+APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t
*ht);
/**
* Continue iterating over the entries in a hash table.
1.22 +2 -2 apr/tables/apr_hash.c
Index: apr_hash.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_hash.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- apr_hash.c 2001/08/01 23:22:47 1.21
+++ apr_hash.c 2001/08/02 00:03:44 1.22
@@ -155,10 +155,10 @@
return hi;
}
-APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_hash_t *ht)
+APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht)
{
apr_hash_index_t *hi;
- hi = apr_palloc(ht->pool, sizeof(*hi));
+ hi = apr_palloc(p, sizeof(*hi));
hi->ht = ht;
hi->index = 0;
hi->this = NULL;