summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2003-01-13 18:52:07 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2003-01-13 18:52:07 +0000
commita13e9028c07d0e6da60d02e6009bbd2d82921132 (patch)
treea3aa8dd574fdce177d74c7f1f9a2f3c94e216f77 /tables
parent0d5c1ec01e2ab459847c240551cec2db9a6a2a90 (diff)
downloadlibapr-a13e9028c07d0e6da60d02e6009bbd2d82921132.tar.gz
A binary-safe patch that satisfies Jerenkrantz's original desire for
more elements, but structured such that we still use the optimal platform element indexes (a machine int is generally faster than a fractional int). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64291 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_hash.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/tables/apr_hash.c b/tables/apr_hash.c
index 0898648e8..153b96eb7 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;
- apr_uint32_t hash;
+ unsigned int 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;
- apr_uint32_t index;
+ unsigned int 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, ...) */
- apr_uint32_t count, max;
+ unsigned int 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, apr_uint32_t max)
+static apr_hash_entry_t **alloc_array(apr_hash_t *ht, unsigned int max)
{
return apr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1));
}
@@ -192,14 +192,12 @@ static void expand_array(apr_hash_t *ht)
{
apr_hash_index_t *hi;
apr_hash_entry_t **new_array;
- apr_uint32_t new_max;
+ unsigned int 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_uint32_t i;
-
- i = hi->this->hash & new_max;
+ unsigned int i = hi->this->hash & new_max;
hi->this->next = new_array[i];
new_array[i] = hi->this;
}
@@ -223,7 +221,7 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht,
{
apr_hash_entry_t **hep, *he;
const unsigned char *p;
- apr_uint32_t hash;
+ unsigned int hash;
apr_ssize_t i;
/*
@@ -304,7 +302,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
{
apr_hash_t *ht;
apr_hash_entry_t *new_vals;
- apr_uint32_t i, j;
+ unsigned int i, j;
ht = apr_palloc(pool, sizeof(apr_hash_t) +
sizeof(*ht->array) * (orig->max + 1) +
@@ -371,7 +369,7 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht,
/* else key not present and val==NULL */
}
-APR_DECLARE(apr_uint32_t) apr_hash_count(apr_hash_t *ht)
+APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht)
{
return ht->count;
}
@@ -398,7 +396,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;
- apr_uint32_t i,j,k;
+ unsigned int i,j,k;
#ifdef POOL_DEBUG
/* we don't copy keys and values, so it's necessary that