summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2001-07-09 12:06:37 +0000
committerEzra Peisach <epeisach@mit.edu>2001-07-09 12:06:37 +0000
commit09e7bea3c3181194c2baae22a9fc6abd2ca3a955 (patch)
tree3bc5611311f464aa620dab92d6a7ea58528c7391 /src
parent01a225e27c6816bfb17e9ed94d5f859b3916df2f (diff)
downloadkrb5-09e7bea3c3181194c2baae22a9fc6abd2ca3a955.tar.gz
krb5-09e7bea3c3181194c2baae22a9fc6abd2ca3a955.tar.xz
krb5-09e7bea3c3181194c2baae22a9fc6abd2ca3a955.zip
* hash/hash_func.c (hash4): Declare first argument const
* hash/hash.h: struct HTAB fname element now const. * hash/hash.c: Declare third argument to hash_access and init_hash const. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13590 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/db2/ChangeLog9
-rw-r--r--src/util/db2/hash/hash.c19
-rw-r--r--src/util/db2/hash/hash.h2
-rw-r--r--src/util/db2/hash/hash_func.c4
4 files changed, 22 insertions, 12 deletions
diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog
index 40f8923ac..cf9a91631 100644
--- a/src/util/db2/ChangeLog
+++ b/src/util/db2/ChangeLog
@@ -1,3 +1,12 @@
+2001-07-08 Ezra Peisach <epeisach@mit.edu>
+
+ * hash/hash_func.c (hash4): Declare first argument const.
+
+ * hash/hash.h: struct HTAB fname element now const.
+
+ * hash/hash.c: Declare third argument to hash_access and init_hash
+ const.
+
2001-07-06 Ezra Peisach <epeisach@mit.edu>
* hash/dbm.c: Include db-dbm.h for prototypes.
diff --git a/src/util/db2/hash/hash.c b/src/util/db2/hash/hash.c
index 365bb415c..0e254938e 100644
--- a/src/util/db2/hash/hash.c
+++ b/src/util/db2/hash/hash.c
@@ -57,7 +57,7 @@ static char sccsid[] = "@(#)hash.c 8.12 (Berkeley) 11/7/95";
#include "extern.h"
static int32_t flush_meta __P((HTAB *));
-static int32_t hash_access __P((HTAB *, ACTION, DBT *, DBT *));
+static int32_t hash_access __P((HTAB *, ACTION, const DBT *, DBT *));
static int32_t hash_close __P((DB *));
static int32_t hash_delete __P((const DB *, const DBT *, u_int32_t));
static int32_t hash_fd __P((const DB *));
@@ -69,7 +69,7 @@ static int32_t hdestroy __P((HTAB *));
static int32_t cursor_get __P((const DB *, CURSOR *, DBT *, DBT *, \
u_int32_t));
static int32_t cursor_delete __P((const DB *, CURSOR *, u_int32_t));
-static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *));
+static HTAB *init_hash __P((HTAB *, const char *, const HASHINFO *));
static int32_t init_htab __P((HTAB *, int32_t));
#if DB_BYTE_ORDER == DB_LITTLE_ENDIAN
static void swap_header __P((HTAB *));
@@ -118,7 +118,7 @@ __kdb2_hash_open(file, flags, mode, info, dflags)
if (!file) {
file = tmpnam(NULL);
/* store the file name so that we can unlink it later */
- hashp->fname = (char *)file;
+ hashp->fname = file;
#ifdef DEBUG
fprintf(stderr, "Using file name %s.\n", file);
#endif
@@ -147,7 +147,7 @@ __kdb2_hash_open(file, flags, mode, info, dflags)
/* Process arguments to set up hash table header. */
if (new_table) {
- if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
+ if (!(hashp = init_hash(hashp, file, info)))
RETURN_ERROR(errno, error1);
} else {
/* Table already exists */
@@ -308,7 +308,7 @@ static HTAB *
init_hash(hashp, file, info)
HTAB *hashp;
const char *file;
- HASHINFO *info;
+ const HASHINFO *info;
{
struct stat statbuf;
int32_t nelem;
@@ -634,7 +634,7 @@ hash_get(dbp, key, data, flag)
hashp->local_errno = errno = EINVAL;
return (ERROR);
}
- return (hash_access(hashp, HASH_GET, (DBT *)key, data));
+ return (hash_access(hashp, HASH_GET, key, data));
}
static int32_t
@@ -656,7 +656,7 @@ hash_put(dbp, key, data, flag)
return (ERROR);
}
return (hash_access(hashp, flag == R_NOOVERWRITE ?
- HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data));
+ HASH_PUTNEW : HASH_PUT, key, (DBT *)data));
}
static int32_t
@@ -677,7 +677,7 @@ hash_delete(dbp, key, flag)
return (ERROR);
}
- return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
+ return (hash_access(hashp, HASH_DELETE, key, NULL));
}
/*
@@ -687,7 +687,8 @@ static int32_t
hash_access(hashp, action, key, val)
HTAB *hashp;
ACTION action;
- DBT *key, *val;
+ const DBT *key;
+ DBT *val;
{
DBT page_key, page_val;
CURSOR cursor;
diff --git a/src/util/db2/hash/hash.h b/src/util/db2/hash/hash.h
index 170c24c86..b202fc9f2 100644
--- a/src/util/db2/hash/hash.h
+++ b/src/util/db2/hash/hash.h
@@ -89,7 +89,7 @@ typedef struct htab { /* Memory resident data structure */
u_int32_t (*hash) __P((const void *, size_t)); /* Hash Function */
int32_t flags; /* Flag values */
int32_t fp; /* File pointer */
- char *fname; /* File path */
+ const char *fname; /* File path */
u_int8_t *bigdata_buf; /* Temporary Buffer for BIG data */
u_int8_t *bigkey_buf; /* Temporary Buffer for BIG keys */
u_int16_t *split_buf; /* Temporary buffer for splits */
diff --git a/src/util/db2/hash/hash_func.c b/src/util/db2/hash/hash_func.c
index baded7fdb..1dee69460 100644
--- a/src/util/db2/hash/hash_func.c
+++ b/src/util/db2/hash/hash_func.c
@@ -164,14 +164,14 @@ hash4(key, len)
size_t len;
{
u_int32_t h, loop;
- u_int8_t *k;
+ const u_int8_t *k;
#define HASH4a h = (h << 5) - h + *k++;
#define HASH4b h = (h << 5) + h + *k++;
#define HASH4 HASH4b
h = 0;
- k = (u_int8_t *)key;
+ k = (const u_int8_t *)key;
if (len > 0) {
loop = (len + 8 - 1) >> 3;