diff options
Diffstat (limited to 'lib/libc/db/recno')
| -rw-r--r-- | lib/libc/db/recno/rec_delete.c | 13 | ||||
| -rw-r--r-- | lib/libc/db/recno/rec_put.c | 18 | ||||
| -rw-r--r-- | lib/libc/db/recno/rec_search.c | 14 |
3 files changed, 21 insertions, 24 deletions
diff --git a/lib/libc/db/recno/rec_delete.c b/lib/libc/db/recno/rec_delete.c index f6ef4b4a16b9..d799da282ceb 100644 --- a/lib/libc/db/recno/rec_delete.c +++ b/lib/libc/db/recno/rec_delete.c @@ -138,16 +138,13 @@ rec_rdelete(BTREE *t, recno_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) - BTREE *t; - PAGE *h; - u_int32_t index; +__rec_dleaf(BTREE *t, PAGE *h, u_int32_t idx) { RLEAF *rl; indx_t *ip, cnt, offset; @@ -165,7 +162,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); @@ -178,8 +175,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 3033a274e7d3..ae60065ecaac 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -191,7 +191,7 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int 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; @@ -222,7 +222,7 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int 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 @@ -232,13 +232,13 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int 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); } @@ -252,18 +252,18 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int 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 61bcb7509441..68e7f2d195df 100644 --- a/lib/libc/db/recno/rec_search.c +++ b/lib/libc/db/recno/rec_search.c @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); EPG * __rec_search(BTREE *t, recno_t recno, enum SRCHOP op) { - indx_t index; + indx_t idx; PAGE *h; EPGNO *parent; RINTERNAL *r; @@ -79,23 +79,23 @@ __rec_search(BTREE *t, recno_t recno, enum SRCHOP 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: |
