summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Stein <gstein@apache.org>2000-07-10 02:58:20 +0000
committerGreg Stein <gstein@apache.org>2000-07-10 02:58:20 +0000
commitea8506eb7054432b0fe330bbc1a2a6cb6665d4e7 (patch)
treebfde68952d9e4f096a79e7ecb57188163c9217f6 /lib
parent274f174a9d6eb3179d6d6857a899a4e687eb8200 (diff)
downloadapr-ea8506eb7054432b0fe330bbc1a2a6cb6665d4e7.tar.gz
const-ify the hash table interfaces/implementation
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60322 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib')
-rw-r--r--lib/apr_hash.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/apr_hash.c b/lib/apr_hash.c
index 5033c8a08..e2162e176 100644
--- a/lib/apr_hash.c
+++ b/lib/apr_hash.c
@@ -85,9 +85,9 @@ typedef struct ap_hash_entry_t ap_hash_entry_t;
struct ap_hash_entry_t {
ap_hash_entry_t *next;
int hash;
- void *key;
+ const void *key;
size_t klen;
- void *val;
+ const void *val;
};
/*
@@ -167,13 +167,13 @@ APR_EXPORT(ap_hash_index_t *) ap_hash_first(ap_hash_t *ht)
}
APR_EXPORT(void) ap_hash_this(ap_hash_index_t *hi,
- void **key,
+ const void **key,
size_t *klen,
- void **val)
+ void **val)
{
if (key) *key = hi->this->key;
if (klen) *klen = hi->this->klen;
- if (val) *val = hi->this->val;
+ if (val) *val = (void *)hi->this->val;
}
@@ -206,12 +206,12 @@ static void resize_array(ap_hash_t *ht)
*/
static ap_hash_entry_t **find_entry(ap_hash_t *ht,
- void *key,
+ const void *key,
size_t klen,
- void *val)
+ const void *val)
{
ap_hash_entry_t **hep, *he;
- unsigned char *p;
+ const unsigned char *p;
int hash;
int i;
@@ -254,21 +254,21 @@ static ap_hash_entry_t **find_entry(ap_hash_t *ht,
}
APR_EXPORT(void *) ap_hash_get(ap_hash_t *ht,
- void *key,
+ const void *key,
size_t klen)
{
ap_hash_entry_t *he;
he = *find_entry(ht, key, klen, NULL);
if (he)
- return he->val;
+ return (void *)he->val;
else
return NULL;
}
APR_EXPORT(void) ap_hash_set(ap_hash_t *ht,
- void *key,
+ const void *key,
size_t klen,
- void *val)
+ const void *val)
{
ap_hash_entry_t **hep;
hep = find_entry(ht, key, klen, val);