2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1999-2002
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id$";
14
#ifndef NO_SYSTEM_INCLUDES
15
#include <sys/types.h>
19
#include "dbinc/db_page.h"
20
#include "dbinc/hash.h"
22
static int __ham_set_h_ffactor __P((DB *, u_int32_t));
23
static int __ham_set_h_hash
24
__P((DB *, u_int32_t(*)(DB *, const void *, u_int32_t)));
25
static int __ham_set_h_nelem __P((DB *, u_int32_t));
29
* Hash specific initialization of the DB structure.
31
* PUBLIC: int __ham_db_create __P((DB *));
40
if ((ret = __os_malloc(dbp->dbenv,
41
sizeof(HASH), &dbp->h_internal)) != 0)
44
hashp = dbp->h_internal;
46
hashp->h_nelem = 0; /* Defaults. */
50
dbp->set_h_ffactor = __ham_set_h_ffactor;
51
dbp->set_h_hash = __ham_set_h_hash;
52
dbp->set_h_nelem = __ham_set_h_nelem;
58
* PUBLIC: int __ham_db_close __P((DB *));
64
if (dbp->h_internal == NULL)
66
__os_free(dbp->dbenv, dbp->h_internal);
67
dbp->h_internal = NULL;
72
* __ham_set_h_ffactor --
73
* Set the fill factor.
76
__ham_set_h_ffactor(dbp, h_ffactor)
82
DB_ILLEGAL_AFTER_OPEN(dbp, "set_h_ffactor");
83
DB_ILLEGAL_METHOD(dbp, DB_OK_HASH);
85
hashp = dbp->h_internal;
86
hashp->h_ffactor = h_ffactor;
92
* Set the hash function.
95
__ham_set_h_hash(dbp, func)
97
u_int32_t (*func) __P((DB *, const void *, u_int32_t));
101
DB_ILLEGAL_AFTER_OPEN(dbp, "set_h_hash");
102
DB_ILLEGAL_METHOD(dbp, DB_OK_HASH);
104
hashp = dbp->h_internal;
105
hashp->h_hash = func;
110
* __ham_set_h_nelem --
111
* Set the table size.
114
__ham_set_h_nelem(dbp, h_nelem)
120
DB_ILLEGAL_AFTER_OPEN(dbp, "set_h_nelem");
121
DB_ILLEGAL_METHOD(dbp, DB_OK_HASH);
123
hashp = dbp->h_internal;
124
hashp->h_nelem = h_nelem;