You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by André Malo <nd...@perlig.de> on 2004/04/18 18:58:42 UTC
Re: cvs commit: apr/test testhash.c
* rbb@apache.org wrote:
> +APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool,
> + apr_hashfunc_t hash_func)
> +{
> + ht = apr_hash_make(p);
> + ht->hash_func = hash_func;
> return ht;
> }
>
I've thought there were a rule to check in only stuff that compiles...
Index: apr_hash.c
===================================================================
RCS file: /home/cvspublic/apr/tables/apr_hash.c,v
retrieving revision 1.37
diff -u -r1.37 apr_hash.c
--- apr_hash.c 18 Apr 2004 12:12:49 -0000 1.37
+++ apr_hash.c 18 Apr 2004 16:57:17 -0000
@@ -102,7 +102,7 @@
APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool,
apr_hashfunc_t hash_func)
{
- ht = apr_hash_make(p);
+ apr_hash_t *ht = apr_hash_make(pool);
ht->hash_func = hash_func;
return ht;
}
nd
--
"Solides und umfangreiches Buch"
-- aus einer Rezension
<http://pub.perlig.de/books.html#apache2>
Re: cvs commit: apr/test testhash.c
Posted by André Malo <nd...@perlig.de>.
* André Malo <nd...@perlig.de> wrote:
> APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool,
> apr_hashfunc_t hash_func)
Additionally hash_func should be a pointer (also in declaration in in the hash
struct), shouldn't it?
nd
--
Treat your password like your toothbrush. Don't let anybody else
use it, and get a new one every six months. -- Clifford Stoll
(found in ssl_engine_pphrase.c)
Re: cvs commit: apr/test testhash.c
Posted by Joe Orton <jo...@redhat.com>.
This broke apr_hash_{merge,overlay}; I've checked in a minimal fix to
stop httpd segfaulting everywhere, but presumable it needs a doc string
update as below, unless behaviour for merging two hash tables with
different hash functions can be defined:
--- include/apr_hash.h 18 Apr 2004 12:12:49 -0000 1.42
+++ include/apr_hash.h 19 Apr 2004 08:56:02 -0000
@@ -173,7 +173,8 @@
/**
* Merge two hash tables into one new hash table. The values of the overlay
- * hash override the values of the base if both have the same key.
+ * hash override the values of the base if both have the same key. Both
+ * hash tables must use the same hash function.
* @param p The pool to use for the new hash table
* @param overlay The table to add to the initial table
* @param base The table that represents the initial values of the new table
@@ -186,7 +187,8 @@
/**
* Merge two hash tables into one new hash table. If the same key
* is present in both tables, call the supplied merge function to
- * produce a merged value for the key in the new table.
+ * produce a merged value for the key in the new table. Both
+ * hash tables must use the same hash function.
* @param p The pool to use for the new hash table
* @param h1 The first of the tables to merge
* @param h2 The second of the tables to merge