Deleted Added
full compact
hash.c (190496) hash.c (196525)
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Margo Seltzer.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Margo Seltzer.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/db/hash/hash.c 190496 2009-03-28 07:20:39Z delphij $");
37__FBSDID("$FreeBSD: head/lib/libc/db/hash/hash.c 196525 2009-08-24 23:44:07Z delphij $");
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/stat.h>
42
43#include <errno.h>
44#include <fcntl.h>
45#include <stdio.h>

--- 660 unchanged lines hidden (view full) ---

706#ifdef HASH_STATISTICS
707 hash_accesses++;
708#endif
709 if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
710 hashp->cbucket = 0;
711 hashp->cndx = 1;
712 hashp->cpage = NULL;
713 }
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/stat.h>
42
43#include <errno.h>
44#include <fcntl.h>
45#include <stdio.h>

--- 660 unchanged lines hidden (view full) ---

706#ifdef HASH_STATISTICS
707 hash_accesses++;
708#endif
709 if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
710 hashp->cbucket = 0;
711 hashp->cndx = 1;
712 hashp->cpage = NULL;
713 }
714 next_bucket:
714next_bucket:
715 for (bp = NULL; !bp || !bp[0]; ) {
716 if (!(bufp = hashp->cpage)) {
717 for (bucket = hashp->cbucket;
718 bucket <= hashp->MAX_BUCKET;
719 bucket++, hashp->cndx = 1) {
720 bufp = __get_buf(hashp, bucket, NULL, 0);
721 if (!bufp)
722 return (ERROR);

--- 4 unchanged lines hidden (view full) ---

727 }
728 hashp->cbucket = bucket;
729 if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) {
730 hashp->cbucket = -1;
731 return (ABNORMAL);
732 }
733 } else {
734 bp = (u_int16_t *)hashp->cpage->page;
715 for (bp = NULL; !bp || !bp[0]; ) {
716 if (!(bufp = hashp->cpage)) {
717 for (bucket = hashp->cbucket;
718 bucket <= hashp->MAX_BUCKET;
719 bucket++, hashp->cndx = 1) {
720 bufp = __get_buf(hashp, bucket, NULL, 0);
721 if (!bufp)
722 return (ERROR);

--- 4 unchanged lines hidden (view full) ---

727 }
728 hashp->cbucket = bucket;
729 if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) {
730 hashp->cbucket = -1;
731 return (ABNORMAL);
732 }
733 } else {
734 bp = (u_int16_t *)hashp->cpage->page;
735 if (flag == R_NEXT) {
735 if (flag == R_NEXT || flag == 0) {
736 hashp->cndx += 2;
737 if (hashp->cndx > bp[0]) {
738 hashp->cpage = NULL;
739 hashp->cbucket++;
740 hashp->cndx = 1;
741 goto next_bucket;
742 }
743 }

--- 220 unchanged lines hidden ---
736 hashp->cndx += 2;
737 if (hashp->cndx > bp[0]) {
738 hashp->cpage = NULL;
739 hashp->cbucket++;
740 hashp->cndx = 1;
741 goto next_bucket;
742 }
743 }

--- 220 unchanged lines hidden ---