summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2002-12-23 20:41:17 +0000
committerjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2002-12-23 20:41:17 +0000
commitea628095af10e21bcccd7646e5391797407f71aa (patch)
tree79eca885e8833f334f5deadedf56a9637b3b1e9f /tables
parent7cb35bdee0f5a3e645a2fcc522047eb267207506 (diff)
downloadlibapr-ea628095af10e21bcccd7646e5391797407f71aa.tar.gz
Allow apr_hash to have greater than int number of elements.
(serf_spider needs a ridiculously large hash table.) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_hash.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/tables/apr_hash.c b/tables/apr_hash.c
index 4a0fc5dbe..3947ecf6e 100644
--- a/tables/apr_hash.c
+++ b/tables/apr_hash.c
@@ -84,7 +84,7 @@ typedef struct apr_hash_entry_t apr_hash_entry_t;
struct apr_hash_entry_t {
apr_hash_entry_t *next;
- int hash;
+ apr_size_t hash;
const void *key;
apr_ssize_t klen;
const void *val;
@@ -100,7 +100,7 @@ struct apr_hash_entry_t {
struct apr_hash_index_t {
apr_hash_t *ht;
apr_hash_entry_t *this, *next;
- int index;
+ apr_size_t index;
};
/*
@@ -114,7 +114,7 @@ struct apr_hash_t {
apr_pool_t *pool;
apr_hash_entry_t **array;
apr_hash_index_t iterator; /* For apr_hash_first(NULL, ...) */
- int count, max;
+ apr_size_t count, max;
};
#define INITIAL_MAX 15 /* tunable == 2^n - 1 */
@@ -124,7 +124,7 @@ struct apr_hash_t {
* Hash creation functions.
*/
-static apr_hash_entry_t **alloc_array(apr_hash_t *ht, int max)
+static apr_hash_entry_t **alloc_array(apr_hash_t *ht, apr_size_t max)
{
return apr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1));
}
@@ -192,12 +192,13 @@ static void expand_array(apr_hash_t *ht)
{
apr_hash_index_t *hi;
apr_hash_entry_t **new_array;
- int new_max;
- int i;
+ apr_size_t new_max;
new_max = ht->max * 2 + 1;
new_array = alloc_array(ht, new_max);
for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi)) {
+ apr_size_t i;
+
i = hi->this->hash & new_max;
hi->this->next = new_array[i];
new_array[i] = hi->this;
@@ -222,7 +223,7 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht,
{
apr_hash_entry_t **hep, *he;
const unsigned char *p;
- int hash;
+ apr_size_t hash;
apr_ssize_t i;
/*
@@ -303,7 +304,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
{
apr_hash_t *ht;
apr_hash_entry_t *new_vals;
- int i, j;
+ apr_size_t i, j;
ht = apr_palloc(pool, sizeof(apr_hash_t) +
sizeof(*ht->array) * (orig->max + 1) +
@@ -370,7 +371,7 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht,
/* else key not present and val==NULL */
}
-APR_DECLARE(int) apr_hash_count(apr_hash_t *ht)
+APR_DECLARE(apr_size_t) apr_hash_count(apr_hash_t *ht)
{
return ht->count;
}
@@ -397,7 +398,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
apr_hash_entry_t *new_vals = NULL;
apr_hash_entry_t *iter;
apr_hash_entry_t *ent;
- int i,j,k;
+ apr_size_t i,j,k;
#ifdef POOL_DEBUG
/* we don't copy keys and values, so it's necessary that