summaryrefslogtreecommitdiff
path: root/lib/libc/db/btree
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-02-25 23:45:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-02-25 23:45:16 +0000
commit8a01f656c9da504eda625918b5c5ecc532d1f5cf (patch)
treea2f2a7f098a8be71bdce5865e824fdb3fda06189 /lib/libc/db/btree
parenteba16209fa8b8e6991410defed82fd681845f75b (diff)
Cosmetic changes such as correct printf format specifiers on LP64
machines and whitespace nits. Some from NetBSD.
Diffstat (limited to 'lib/libc/db/btree')
-rw-r--r--lib/libc/db/btree/bt_debug.c44
-rw-r--r--lib/libc/db/btree/bt_open.c12
-rw-r--r--lib/libc/db/btree/bt_split.c15
3 files changed, 34 insertions, 37 deletions
diff --git a/lib/libc/db/btree/bt_debug.c b/lib/libc/db/btree/bt_debug.c
index d09bb9e93c5..cf652e4741b 100644
--- a/lib/libc/db/btree/bt_debug.c
+++ b/lib/libc/db/btree/bt_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bt_debug.c,v 1.4 1999/02/15 05:11:22 millert Exp $ */
+/* $OpenBSD: bt_debug.c,v 1.5 2002/02/25 23:45:14 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
#else
-static char rcsid[] = "$OpenBSD: bt_debug.c,v 1.4 1999/02/15 05:11:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: bt_debug.c,v 1.5 2002/02/25 23:45:14 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -70,10 +70,10 @@ __bt_dump(dbp)
char *sep;
t = dbp->internal;
- (void)fprintf(stderr, "%s: pgsz %d",
+ (void)fprintf(stderr, "%s: pgsz %u",
F_ISSET(t, B_INMEM) ? "memory" : "disk", t->bt_psize);
if (F_ISSET(t, R_RECNO))
- (void)fprintf(stderr, " keys %lu", t->bt_nrecs);
+ (void)fprintf(stderr, " keys %u", t->bt_nrecs);
#undef X
#define X(flag, name) \
if (F_ISSET(t, flag)) { \
@@ -111,12 +111,12 @@ __bt_dmpage(h)
char *sep;
m = (BTMETA *)h;
- (void)fprintf(stderr, "magic %lx\n", m->magic);
- (void)fprintf(stderr, "version %lu\n", m->version);
- (void)fprintf(stderr, "psize %lu\n", m->psize);
- (void)fprintf(stderr, "free %lu\n", m->free);
- (void)fprintf(stderr, "nrecs %lu\n", m->nrecs);
- (void)fprintf(stderr, "flags %lu", m->flags);
+ (void)fprintf(stderr, "magic %x\n", m->magic);
+ (void)fprintf(stderr, "version %u\n", m->version);
+ (void)fprintf(stderr, "psize %u\n", m->psize);
+ (void)fprintf(stderr, "free %u\n", m->free);
+ (void)fprintf(stderr, "nrecs %u\n", m->nrecs);
+ (void)fprintf(stderr, "flags %u", m->flags);
#undef X
#define X(flag, name) \
if (m->flags & flag) { \
@@ -167,7 +167,7 @@ __bt_dpage(h)
indx_t cur, top;
char *sep;
- (void)fprintf(stderr, " page %d: (", h->pgno);
+ (void)fprintf(stderr, " page %u: (", h->pgno);
#undef X
#define X(flag, name) \
if (h->flags & flag) { \
@@ -184,7 +184,7 @@ __bt_dpage(h)
(void)fprintf(stderr, ")\n");
#undef X
- (void)fprintf(stderr, "\tprev %2d next %2d", h->prevpg, h->nextpg);
+ (void)fprintf(stderr, "\tprev %2u next %2u", h->prevpg, h->nextpg);
if (h->flags & P_OVERFLOW)
return;
@@ -213,14 +213,14 @@ __bt_dpage(h)
bl = GETBLEAF(h, cur);
if (bl->flags & P_BIGKEY)
(void)fprintf(stderr,
- "big key page %lu size %u/",
+ "big key page %u size %u/",
*(pgno_t *)bl->bytes,
*(u_int32_t *)(bl->bytes + sizeof(pgno_t)));
else if (bl->ksize)
(void)fprintf(stderr, "%s/", bl->bytes);
if (bl->flags & P_BIGDATA)
(void)fprintf(stderr,
- "big data page %lu size %u",
+ "big data page %u size %u",
*(pgno_t *)(bl->bytes + bl->ksize),
*(u_int32_t *)(bl->bytes + bl->ksize +
sizeof(pgno_t)));
@@ -232,7 +232,7 @@ __bt_dpage(h)
rl = GETRLEAF(h, cur);
if (rl->flags & P_BIGDATA)
(void)fprintf(stderr,
- "big data page %lu size %u",
+ "big data page %u size %u",
*(pgno_t *)rl->bytes,
*(u_int32_t *)(rl->bytes + sizeof(pgno_t)));
else if (rl->dsize)
@@ -299,27 +299,27 @@ __bt_stat(dbp)
GETBINTERNAL(h, 0)->pgno;
}
- (void)fprintf(stderr, "%d level%s with %ld keys",
+ (void)fprintf(stderr, "%d level%s with %lu keys",
levels, levels == 1 ? "" : "s", nkeys);
if (F_ISSET(t, R_RECNO))
- (void)fprintf(stderr, " (%ld header count)", t->bt_nrecs);
+ (void)fprintf(stderr, " (%u header count)", t->bt_nrecs);
(void)fprintf(stderr,
- "\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n",
+ "\n%u pages (leaf %u, internal %u, overflow %u)\n",
pinternal + pleaf + pcont, pleaf, pinternal, pcont);
- (void)fprintf(stderr, "%ld cache hits, %ld cache misses\n",
+ (void)fprintf(stderr, "%lu cache hits, %lu cache misses\n",
bt_cache_hit, bt_cache_miss);
- (void)fprintf(stderr, "%ld splits (%ld root splits, %ld sort splits)\n",
+ (void)fprintf(stderr, "%lu splits (%lu root splits, %lu sort splits)\n",
bt_split, bt_rootsplit, bt_sortsplit);
pleaf *= t->bt_psize - BTDATAOFF;
if (pleaf)
(void)fprintf(stderr,
- "%.0f%% leaf fill (%ld bytes used, %ld bytes free)\n",
+ "%.0f%% leaf fill (%lu bytes used, %lu bytes free)\n",
((double)(pleaf - lfree) / pleaf) * 100,
pleaf - lfree, lfree);
pinternal *= t->bt_psize - BTDATAOFF;
if (pinternal)
(void)fprintf(stderr,
- "%.0f%% internal fill (%ld bytes used, %ld bytes free\n",
+ "%.0f%% internal fill (%lu bytes used, %lu bytes free\n",
((double)(pinternal - ifree) / pinternal) * 100,
pinternal - ifree, ifree);
if (bt_pfxsaved)
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index fd888c395f7..8f227efbf3b 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bt_open.c,v 1.8 2002/02/16 21:27:22 millert Exp $ */
+/* $OpenBSD: bt_open.c,v 1.9 2002/02/25 23:45:14 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)bt_open.c 8.11 (Berkeley) 11/2/95";
#else
-static char rcsid[] = "$OpenBSD: bt_open.c,v 1.8 2002/02/16 21:27:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: bt_open.c,v 1.9 2002/02/25 23:45:14 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -131,7 +131,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
*/
if (b.psize &&
(b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
- b.psize & (sizeof(indx_t) - 1) ))
+ b.psize & (sizeof(indx_t) - 1)))
goto einval;
/* Minimum number of keys per page; absolute minimum is 2. */
@@ -251,7 +251,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
if (m.magic != BTREEMAGIC || m.version != BTREEVERSION)
goto eftype;
if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 ||
- m.psize & (sizeof(indx_t) - 1) )
+ m.psize & (sizeof(indx_t) - 1))
goto eftype;
if (m.flags & ~SAVEMETA)
goto eftype;
@@ -284,8 +284,8 @@ __bt_open(fname, flags, mode, openinfo, dflags)
t->bt_psize = b.psize;
/* Set the cache size; must be a multiple of the page size. */
- if (b.cachesize && b.cachesize & (b.psize - 1) )
- b.cachesize += (~b.cachesize & (b.psize - 1) ) + 1;
+ if (b.cachesize && b.cachesize & (b.psize - 1))
+ b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
if (b.cachesize < b.psize * MINCACHE)
b.cachesize = b.psize * MINCACHE;
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index b0b0cb3aea0..264b6ecb1fa 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bt_split.c,v 1.8 2002/02/16 21:27:22 millert Exp $ */
+/* $OpenBSD: bt_split.c,v 1.9 2002/02/25 23:45:14 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -38,9 +38,9 @@
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
-static char rcsid[] = "$OpenBSD: bt_split.c,v 1.8 2002/02/16 21:27:22 millert Exp $";
-#else
static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95";
+#else
+static char rcsid[] = "$OpenBSD: bt_split.c,v 1.9 2002/02/25 23:45:14 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -55,13 +55,10 @@ static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95";
#include "btree.h"
static int bt_broot(BTREE *, PAGE *, PAGE *, PAGE *);
-static PAGE *bt_page
-(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
+static PAGE *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static int bt_preserve(BTREE *, pgno_t);
-static PAGE *bt_psplit
-(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
-static PAGE *bt_root
-(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
+static PAGE *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
+static PAGE *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static int bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *);
static recno_t rec_total(PAGE *);