summaryrefslogtreecommitdiff
path: root/lib/libc/db/recno
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-01-03 22:30:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-01-03 22:30:30 +0000
commit0d2c0c671faa3f36c78e0ca4851a0693e19dc4fe (patch)
treedce57478c4e48d6817f8bbf8da2153d7a973c99f /lib/libc/db/recno
parentff43f10cb77f98175073e06d9dac2656879c3a78 (diff)
Avoid namespace pollution by renaming index variables -> idx.
Idea from NetBSD; OK deraadt@
Diffstat (limited to 'lib/libc/db/recno')
-rw-r--r--lib/libc/db/recno/rec_delete.c16
-rw-r--r--lib/libc/db/recno/rec_put.c22
-rw-r--r--lib/libc/db/recno/rec_search.c18
3 files changed, 28 insertions, 28 deletions
diff --git a/lib/libc/db/recno/rec_delete.c b/lib/libc/db/recno/rec_delete.c
index d7dbd9e3302..fbc60e4d658 100644
--- a/lib/libc/db/recno/rec_delete.c
+++ b/lib/libc/db/recno/rec_delete.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rec_delete.c,v 1.7 2003/06/02 20:18:34 millert Exp $ */
+/* $OpenBSD: rec_delete.c,v 1.8 2005/01/03 22:30:29 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)rec_delete.c 8.7 (Berkeley) 7/14/94";
#else
-static const char rcsid[] = "$OpenBSD: rec_delete.c,v 1.7 2003/06/02 20:18:34 millert Exp $";
+static const char rcsid[] = "$OpenBSD: rec_delete.c,v 1.8 2005/01/03 22:30:29 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -147,16 +147,16 @@ rec_rdelete(t, nrec)
*
* Parameters:
* t: tree
- * index: index on current page to delete
+ * idx: index on current page to delete
*
* Returns:
* RET_SUCCESS, RET_ERROR.
*/
int
-__rec_dleaf(t, h, index)
+__rec_dleaf(t, h, idx)
BTREE *t;
PAGE *h;
- u_int32_t index;
+ u_int32_t idx;
{
RLEAF *rl;
indx_t *ip, cnt, offset;
@@ -174,7 +174,7 @@ __rec_dleaf(t, h, index)
* down, overwriting the deleted record and its index. If the record
* uses overflow pages, make them available for reuse.
*/
- to = rl = GETRLEAF(h, index);
+ to = rl = GETRLEAF(h, idx);
if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR)
return (RET_ERROR);
nbytes = NRLEAF(rl);
@@ -187,8 +187,8 @@ __rec_dleaf(t, h, index)
memmove(from + nbytes, from, (char *)to - from);
h->upper += nbytes;
- offset = h->linp[index];
- for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip)
+ offset = h->linp[idx];
+ for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip)
diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c
index 3a06ef67428..3be7e297f7c 100644
--- a/lib/libc/db/recno/rec_put.c
+++ b/lib/libc/db/recno/rec_put.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rec_put.c,v 1.7 2003/06/02 20:18:34 millert Exp $ */
+/* $OpenBSD: rec_put.c,v 1.8 2005/01/03 22:30:29 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)rec_put.c 8.7 (Berkeley) 8/18/94";
#else
-static const char rcsid[] = "$OpenBSD: rec_put.c,v 1.7 2003/06/02 20:18:34 millert Exp $";
+static const char rcsid[] = "$OpenBSD: rec_put.c,v 1.8 2005/01/03 22:30:29 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -200,7 +200,7 @@ __rec_iput(t, nrec, data, flags)
DBT tdata;
EPG *e;
PAGE *h;
- indx_t index, nxtindex;
+ indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, status;
@@ -231,7 +231,7 @@ __rec_iput(t, nrec, data, flags)
return (RET_ERROR);
h = e->page;
- index = e->index;
+ idx = e->index;
/*
* Add the specified key/data pair to the tree. The R_IAFTER and
@@ -241,13 +241,13 @@ __rec_iput(t, nrec, data, flags)
*/
switch (flags) {
case R_IAFTER:
- ++index;
+ ++idx;
break;
case R_IBEFORE:
break;
default:
if (nrec < t->bt_nrecs &&
- __rec_dleaf(t, h, index) == RET_ERROR) {
+ __rec_dleaf(t, h, idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@@ -261,18 +261,18 @@ __rec_iput(t, nrec, data, flags)
*/
nbytes = NRLEAFDBT(data->size);
if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
- status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
+ status = __bt_split(t, h, NULL, data, dflags, nbytes, idx);
if (status == RET_SUCCESS)
++t->bt_nrecs;
return (status);
}
- if (index < (nxtindex = NEXTINDEX(h)))
- memmove(h->linp + index + 1, h->linp + index,
- (nxtindex - index) * sizeof(indx_t));
+ if (idx < (nxtindex = NEXTINDEX(h)))
+ memmove(h->linp + idx + 1, h->linp + idx,
+ (nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
- h->linp[index] = h->upper -= nbytes;
+ h->linp[idx] = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_RLEAF(dest, data, dflags);
diff --git a/lib/libc/db/recno/rec_search.c b/lib/libc/db/recno/rec_search.c
index 7c463f26afb..3d2ce8a6bad 100644
--- a/lib/libc/db/recno/rec_search.c
+++ b/lib/libc/db/recno/rec_search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rec_search.c,v 1.7 2003/06/02 20:18:34 millert Exp $ */
+/* $OpenBSD: rec_search.c,v 1.8 2005/01/03 22:30:29 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)rec_search.c 8.4 (Berkeley) 7/14/94";
#else
-static const char rcsid[] = "$OpenBSD: rec_search.c,v 1.7 2003/06/02 20:18:34 millert Exp $";
+static const char rcsid[] = "$OpenBSD: rec_search.c,v 1.8 2005/01/03 22:30:29 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -68,7 +68,7 @@ __rec_search(t, recno, op)
recno_t recno;
enum SRCHOP op;
{
- register indx_t index;
+ register indx_t idx;
register PAGE *h;
EPGNO *parent;
RINTERNAL *r;
@@ -86,23 +86,23 @@ __rec_search(t, recno, op)
t->bt_cur.index = recno - total;
return (&t->bt_cur);
}
- for (index = 0, top = NEXTINDEX(h);;) {
- r = GETRINTERNAL(h, index);
- if (++index == top || total + r->nrecs > recno)
+ for (idx = 0, top = NEXTINDEX(h);;) {
+ r = GETRINTERNAL(h, idx);
+ if (++idx == top || total + r->nrecs > recno)
break;
total += r->nrecs;
}
- BT_PUSH(t, pg, index - 1);
+ BT_PUSH(t, pg, idx - 1);
pg = r->pgno;
switch (op) {
case SDELETE:
- --GETRINTERNAL(h, (index - 1))->nrecs;
+ --GETRINTERNAL(h, (idx - 1))->nrecs;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
break;
case SINSERT:
- ++GETRINTERNAL(h, (index - 1))->nrecs;
+ ++GETRINTERNAL(h, (idx - 1))->nrecs;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
break;
case SEARCH: