|
Packit |
fd8b60 |
/*-
|
|
Packit |
fd8b60 |
* Copyright (c) 1995
|
|
Packit |
fd8b60 |
* The President and Fellows of Harvard University
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* This code is derived from software contributed to Harvard by
|
|
Packit |
fd8b60 |
* Jeremy Rassen.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
fd8b60 |
* modification, are permitted provided that the following conditions
|
|
Packit |
fd8b60 |
* are met:
|
|
Packit |
fd8b60 |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
fd8b60 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
fd8b60 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
fd8b60 |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
fd8b60 |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
fd8b60 |
* 3. All advertising materials mentioning features or use of this software
|
|
Packit |
fd8b60 |
* must display the following acknowledgement:
|
|
Packit |
fd8b60 |
* This product includes software developed by the University of
|
|
Packit |
fd8b60 |
* California, Berkeley and its contributors.
|
|
Packit |
fd8b60 |
* 4. Neither the name of the University nor the names of its contributors
|
|
Packit |
fd8b60 |
* may be used to endorse or promote products derived from this software
|
|
Packit |
fd8b60 |
* without specific prior written permission.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
Packit |
fd8b60 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
fd8b60 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
fd8b60 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
Packit |
fd8b60 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
fd8b60 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
Packit |
fd8b60 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
Packit |
fd8b60 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
Packit |
fd8b60 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
Packit |
fd8b60 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
Packit |
fd8b60 |
* SUCH DAMAGE.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#if defined(LIBC_SCCS) && !defined(lint)
|
|
Packit |
fd8b60 |
static char sccsid[] = "@(#)hash_debug.c 8.4 (Berkeley) 11/7/95";
|
|
Packit |
fd8b60 |
#endif /* LIBC_SCCS and not lint */
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifdef DEBUG
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* PACKAGE: hashing
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* DESCRIPTION:
|
|
Packit |
fd8b60 |
* Debug routines.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* ROUTINES:
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* External
|
|
Packit |
fd8b60 |
* __dump_bucket
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
#include <stdio.h>
|
|
Packit |
fd8b60 |
#include <string.h>
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#include "db-int.h"
|
|
Packit |
fd8b60 |
#include "hash.h"
|
|
Packit |
fd8b60 |
#include "page.h"
|
|
Packit |
fd8b60 |
#include "extern.h"
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
void
|
|
Packit |
fd8b60 |
__dump_bucket(hashp, bucket)
|
|
Packit |
fd8b60 |
HTAB *hashp;
|
|
Packit |
fd8b60 |
u_int32_t bucket;
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
CURSOR cursor;
|
|
Packit |
fd8b60 |
DBT key, val;
|
|
Packit |
fd8b60 |
ITEM_INFO item_info;
|
|
Packit |
fd8b60 |
int var;
|
|
Packit |
fd8b60 |
char *cp;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
cursor.pagep = NULL;
|
|
Packit |
fd8b60 |
item_info.seek_size = 0;
|
|
Packit |
fd8b60 |
item_info.seek_found_page = 0;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
__get_item_reset(hashp, &cursor);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
cursor.bucket = bucket;
|
|
Packit |
fd8b60 |
for (;;) {
|
|
Packit |
fd8b60 |
__get_item_next(hashp, &cursor, &key, &val, &item_info);
|
|
Packit |
fd8b60 |
if (item_info.status == ITEM_ERROR) {
|
|
Packit |
fd8b60 |
(void)printf("get_item_next returned error\n");
|
|
Packit |
fd8b60 |
break;
|
|
Packit |
fd8b60 |
} else if (item_info.status == ITEM_NO_MORE)
|
|
Packit |
fd8b60 |
break;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (item_info.key_off == BIGPAIR) {
|
|
Packit |
fd8b60 |
if (__big_keydata(hashp, cursor.pagep, &key, &val,
|
|
Packit |
fd8b60 |
item_info.pgndx)) {
|
|
Packit |
fd8b60 |
(void)printf("__big_keydata returned error\n");
|
|
Packit |
fd8b60 |
break;
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (key.size == sizeof(int)) {
|
|
Packit |
fd8b60 |
memcpy(&var, key.data, sizeof(int));
|
|
Packit |
fd8b60 |
(void)printf("%d\n", var);
|
|
Packit |
fd8b60 |
} else {
|
|
Packit |
fd8b60 |
for (cp = (char *)key.data; key.size--; cp++)
|
|
Packit |
fd8b60 |
(void)printf("%c", *cp);
|
|
Packit |
fd8b60 |
(void)printf("\n");
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
__get_item_done(hashp, &cursor);
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
#endif /* DEBUG */
|