summaryrefslogtreecommitdiff
path: root/db/hsearch/hsearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'db/hsearch/hsearch.c')
-rw-r--r--db/hsearch/hsearch.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/db/hsearch/hsearch.c b/db/hsearch/hsearch.c
index 5bcbe93d3..831142490 100644
--- a/db/hsearch/hsearch.c
+++ b/db/hsearch/hsearch.c
@@ -1,8 +1,8 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996-2004
- * Sleepycat Software. All rights reserved.
+ * Copyright (c) 1996-2006
+ * Oracle Corporation. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993
@@ -39,18 +39,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: hsearch.c,v 11.14 2004/01/28 03:36:11 bostic Exp $
+ * $Id: hsearch.c,v 12.7 2006/08/24 14:46:06 bostic Exp $
*/
+#define DB_DBM_HSEARCH 1
#include "db_config.h"
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-
-#include <string.h>
-#endif
-
-#define DB_DBM_HSEARCH 1
#include "db_int.h"
static DB *dbp;
@@ -82,8 +76,8 @@ __db_hcreate(nel)
if ((ret = dbp->set_pagesize(dbp, 512)) != 0 ||
(ret = dbp->set_h_ffactor(dbp, 16)) != 0 ||
(ret = dbp->set_h_nelem(dbp, (u_int32_t)nel)) != 0 ||
- (ret = dbp->open(dbp,
- NULL, NULL, NULL, DB_HASH, DB_CREATE, __db_omode("rw----"))) != 0)
+ (ret = dbp->open(dbp, NULL,
+ NULL, NULL, DB_HASH, DB_CREATE, __db_omode(OWNER_RW))) != 0)
__os_set_errno(ret);
/*
@@ -105,15 +99,12 @@ __db_hsearch(item, action)
__os_set_errno(EINVAL);
return (NULL);
}
- memset(&key, 0, sizeof(key));
+ DB_INIT_DBT(key, item.key, strlen(item.key) + 1);
memset(&val, 0, sizeof(val));
- key.data = item.key;
- key.size = (u_int32_t)strlen(item.key) + 1;
switch (action) {
case ENTER:
- val.data = item.data;
- val.size = (u_int32_t)strlen(item.data) + 1;
+ DB_SET_DBT(val, item.data, strlen(item.data) + 1);
/*
* Try and add the key to the database. If we fail because