diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-01-03 22:30:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-01-03 22:30:30 +0000 |
commit | 0d2c0c671faa3f36c78e0ca4851a0693e19dc4fe (patch) | |
tree | dce57478c4e48d6817f8bbf8da2153d7a973c99f /lib/libc | |
parent | ff43f10cb77f98175073e06d9dac2656879c3a78 (diff) |
Avoid namespace pollution by renaming index variables -> idx.
Idea from NetBSD; OK deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/db/btree/bt_delete.c | 78 | ||||
-rw-r--r-- | lib/libc/db/btree/bt_put.c | 30 | ||||
-rw-r--r-- | lib/libc/db/btree/bt_search.c | 16 | ||||
-rw-r--r-- | lib/libc/db/btree/bt_seq.c | 30 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_delete.c | 16 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_put.c | 22 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_search.c | 18 |
7 files changed, 105 insertions, 105 deletions
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c index aea371e4b4a..a9d66dec560 100644 --- a/lib/libc/db/btree/bt_delete.c +++ b/lib/libc/db/btree/bt_delete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_delete.c,v 1.8 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: bt_delete.c,v 1.9 2005/01/03 22:30:28 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94"; #else -static const char rcsid[] = "$OpenBSD: bt_delete.c,v 1.8 2003/06/02 20:18:33 millert Exp $"; +static const char rcsid[] = "$OpenBSD: bt_delete.c,v 1.9 2005/01/03 22:30:28 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -152,7 +152,7 @@ __bt_stkacq(t, hp, c) EPG *e; EPGNO *parent; PAGE *h; - indx_t index; + indx_t idx; pgno_t pgno; recno_t nextpg, prevpg; int exact, level; @@ -190,8 +190,8 @@ __bt_stkacq(t, hp, c) /* Move to the next index. */ if (parent->index != NEXTINDEX(h) - 1) { - index = parent->index + 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index + 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -200,7 +200,7 @@ __bt_stkacq(t, hp, c) /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; BT_PUSH(t, pgno, 0); @@ -210,7 +210,7 @@ __bt_stkacq(t, hp, c) /* Get the next level down. */ if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = 0; + idx = 0; } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL) @@ -245,8 +245,8 @@ __bt_stkacq(t, hp, c) /* Move to the next index. */ if (parent->index != 0) { - index = parent->index - 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index - 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -255,7 +255,7 @@ __bt_stkacq(t, hp, c) /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; /* Lose the currently pinned page. */ @@ -265,8 +265,8 @@ __bt_stkacq(t, hp, c) if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = NEXTINDEX(h) - 1; - BT_PUSH(t, pgno, index); + idx = NEXTINDEX(h) - 1; + BT_PUSH(t, pgno, idx); } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) @@ -384,7 +384,7 @@ __bt_pdelete(t, h) BINTERNAL *bi; PAGE *pg; EPGNO *parent; - indx_t cnt, index, *ip, offset; + indx_t cnt, idx, *ip, offset; u_int32_t nksize; char *from; @@ -405,8 +405,8 @@ __bt_pdelete(t, h) if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - index = parent->index; - bi = GETBINTERNAL(pg, index); + idx = parent->index; + bi = GETBINTERNAL(pg, idx); /* Free any overflow pages. */ if (bi->flags & P_BIGKEY && @@ -438,11 +438,11 @@ __bt_pdelete(t, h) pg->upper += nksize; /* Adjust indices' offsets, shift the indices down. */ - offset = pg->linp[index]; - for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip) + offset = pg->linp[idx]; + for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nksize; - for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1]; pg->lower -= sizeof(indx_t); } @@ -467,17 +467,17 @@ __bt_pdelete(t, h) * t: tree * key: referenced key * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int -__bt_dleaf(t, key, h, index) +__bt_dleaf(t, key, h, idx) BTREE *t; const DBT *key; PAGE *h; - u_int index; + u_int idx; { BLEAF *bl; indx_t cnt, *ip, offset; @@ -488,12 +488,12 @@ __bt_dleaf(t, key, h, index) /* If this record is referenced by the cursor, delete the cursor. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index && - __bt_curdel(t, key, h, index)) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx && + __bt_curdel(t, key, h, idx)) return (RET_ERROR); /* If the entry uses overflow pages, make them available for reuse. */ - to = bl = GETBLEAF(h, index); + to = bl = GETBLEAF(h, idx); if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR) return (RET_ERROR); if (bl->flags & P_BIGDATA && @@ -507,18 +507,18 @@ __bt_dleaf(t, key, h, index) h->upper += nbytes; /* Adjust the indices' offsets, shift the indices down. */ - offset = h->linp[index]; - for (cnt = index, ip = &h->linp[0]; cnt--; ++ip) + offset = h->linp[idx]; + for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; - for (cnt = NEXTINDEX(h) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1]; h->lower -= sizeof(indx_t); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx) --t->bt_cursor.pg.index; return (RET_SUCCESS); @@ -532,17 +532,17 @@ __bt_dleaf(t, key, h, index) * t: tree * key: referenced key (or NULL) * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ static int -__bt_curdel(t, key, h, index) +__bt_curdel(t, key, h, idx) BTREE *t; const DBT *key; PAGE *h; - u_int index; + u_int idx; { CURSOR *c; EPG e; @@ -565,7 +565,7 @@ __bt_curdel(t, key, h, index) */ if (key == NULL) { e.page = h; - e.index = index; + e.index = idx; if ((status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS) return (status); @@ -573,25 +573,25 @@ __bt_curdel(t, key, h, index) key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (index > 0) { + if (idx > 0) { e.page = h; - e.index = index - 1; + e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_BEFORE); goto dup2; } } /* Check next key, if not at the end of the page. */ - if (index < NEXTINDEX(h) - 1) { + if (idx < NEXTINDEX(h) - 1) { e.page = h; - e.index = index + 1; + e.index = idx + 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_AFTER); goto dup2; } } /* Check previous key if at the beginning of the page. */ - if (index == 0 && h->prevpg != P_INVALID) { + if (idx == 0 && h->prevpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -603,7 +603,7 @@ __bt_curdel(t, key, h, index) mpool_put(t->bt_mp, pg, 0); } /* Check next key if at the end of the page. */ - if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { + if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -619,7 +619,7 @@ dup2: c->pg.pgno = e.page->pgno; } } e.page = h; - e.index = index; + e.index = idx; if (curcopy || (status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) { F_SET(c, CURS_ACQUIRE); diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c index 5c3980bbf90..b969232e901 100644 --- a/lib/libc/db/btree/bt_put.c +++ b/lib/libc/db/btree/bt_put.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_put.c,v 1.10 2005/01/03 22:19:38 millert Exp $ */ +/* $OpenBSD: bt_put.c,v 1.11 2005/01/03 22:30:28 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)bt_put.c 8.8 (Berkeley) 7/26/94"; #else -static const char rcsid[] = "$OpenBSD: bt_put.c,v 1.10 2005/01/03 22:19:38 millert Exp $"; +static const char rcsid[] = "$OpenBSD: bt_put.c,v 1.11 2005/01/03 22:30:28 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -76,7 +76,7 @@ __bt_put(dbp, key, data, flags) DBT tkey, tdata; EPG *e; PAGE *h; - indx_t index, nxtindex; + indx_t idx, nxtindex; pgno_t pg; u_int32_t nbytes, size32; int dflags, exact, status; @@ -157,7 +157,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR) if (flags == R_CURSOR) { if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL) return (RET_ERROR); - index = t->bt_cursor.pg.index; + idx = t->bt_cursor.pg.index; goto delete; } @@ -169,7 +169,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR) if ((e = __bt_search(t, key, &exact)) == NULL) return (RET_ERROR); h = e->page; - index = e->index; + idx = e->index; /* * Add the key/data pair to the tree. If an identical key is already @@ -191,7 +191,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR) * Note, the delete may empty the page, so we need to put a * new entry into the page immediately. */ -delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { +delete: if (__bt_dleaf(t, key, h, idx) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } @@ -207,35 +207,35 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { nbytes = NBLEAFDBT(key->size, data->size); if (h->upper - h->lower < nbytes + sizeof(indx_t)) { if ((status = __bt_split(t, h, key, - data, dflags, nbytes, index)) != RET_SUCCESS) + data, dflags, nbytes, idx)) != RET_SUCCESS) return (status); goto success; } - 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_BLEAF(dest, key, data, dflags); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx) ++t->bt_cursor.pg.index; if (t->bt_order == NOT) { if (h->nextpg == P_INVALID) { - if (index == NEXTINDEX(h) - 1) { + if (idx == NEXTINDEX(h) - 1) { t->bt_order = FORWARD; - t->bt_last.index = index; + t->bt_last.index = idx; t->bt_last.pgno = h->pgno; } } else if (h->prevpg == P_INVALID) { - if (index == 0) { + if (idx == 0) { t->bt_order = BACK; t->bt_last.index = 0; t->bt_last.pgno = h->pgno; diff --git a/lib/libc/db/btree/bt_search.c b/lib/libc/db/btree/bt_search.c index d9ac1d851e4..d198f774e0e 100644 --- a/lib/libc/db/btree/bt_search.c +++ b/lib/libc/db/btree/bt_search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_search.c,v 1.7 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: bt_search.c,v 1.8 2005/01/03 22:30:28 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)bt_search.c 8.8 (Berkeley) 7/31/94"; #else -static const char rcsid[] = "$OpenBSD: bt_search.c,v 1.7 2003/06/02 20:18:33 millert Exp $"; +static const char rcsid[] = "$OpenBSD: bt_search.c,v 1.8 2005/01/03 22:30:28 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -71,7 +71,7 @@ __bt_search(t, key, exactp) int *exactp; { PAGE *h; - indx_t base, index, lim; + indx_t base, idx, lim; pgno_t pg; int cmp; @@ -83,7 +83,7 @@ __bt_search(t, key, exactp) /* Do a binary search on the current page. */ t->bt_cur.page = h; for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) { - t->bt_cur.index = index = base + (lim >> 1); + t->bt_cur.index = idx = base + (lim >> 1); if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) { if (h->flags & P_BLEAF) { *exactp = 1; @@ -92,7 +92,7 @@ __bt_search(t, key, exactp) goto next; } if (cmp > 0) { - base = index + 1; + base = idx + 1; --lim; } } @@ -128,10 +128,10 @@ __bt_search(t, key, exactp) * be a parent page for the key. If a split later occurs, the * inserted page will be to the right of the saved page. */ - index = base ? base - 1 : base; + idx = base ? base - 1 : base; -next: BT_PUSH(t, h->pgno, index); - pg = GETBINTERNAL(h, index)->pgno; +next: BT_PUSH(t, h->pgno, idx); + pg = GETBINTERNAL(h, idx)->pgno; mpool_put(t->bt_mp, h, 0); } } diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c index bae17734506..11aa34be35c 100644 --- a/lib/libc/db/btree/bt_seq.c +++ b/lib/libc/db/btree/bt_seq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_seq.c,v 1.8 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: bt_seq.c,v 1.9 2005/01/03 22:30:28 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)bt_seq.c 8.7 (Berkeley) 7/20/94"; #else -static const char rcsid[] = "$OpenBSD: bt_seq.c,v 1.8 2003/06/02 20:18:33 millert Exp $"; +static const char rcsid[] = "$OpenBSD: bt_seq.c,v 1.9 2005/01/03 22:30:28 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -246,7 +246,7 @@ __bt_seqadv(t, ep, flags) { CURSOR *c; PAGE *h; - indx_t index; + indx_t idx; pgno_t pg; int exact; @@ -284,15 +284,15 @@ __bt_seqadv(t, ep, flags) */ if (F_ISSET(c, CURS_AFTER)) goto usecurrent; - index = c->pg.index; - if (++index == NEXTINDEX(h)) { + idx = c->pg.index; + if (++idx == NEXTINDEX(h)) { pg = h->nextpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = 0; + idx = 0; } break; case R_PREV: /* Previous record. */ @@ -307,22 +307,22 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_BEFORE); ep->index = c->pg.index; return (RET_SUCCESS); } - index = c->pg.index; - if (index == 0) { + idx = c->pg.index; + if (idx == 0) { pg = h->prevpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = NEXTINDEX(h) - 1; + idx = NEXTINDEX(h) - 1; } else - --index; + --idx; break; } ep->page = h; - ep->index = index; + ep->index = idx; return (RET_SUCCESS); } @@ -439,13 +439,13 @@ __bt_first(t, key, erval, exactp) * Parameters: * t: the tree * pgno: page number - * index: page index + * idx: page index */ void -__bt_setcur(t, pgno, index) +__bt_setcur(t, pgno, idx) BTREE *t; pgno_t pgno; - u_int index; + u_int idx; { /* Lose any already deleted key. */ if (t->bt_cursor.key.data != NULL) { @@ -457,6 +457,6 @@ __bt_setcur(t, pgno, index) /* Update the cursor. */ t->bt_cursor.pg.pgno = pgno; - t->bt_cursor.pg.index = index; + t->bt_cursor.pg.index = idx; F_SET(&t->bt_cursor, CURS_INIT); } 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: |