* btree/bt_delete.c, btree/bt_put.c, recno/rec_delete.c,
authorEzra Peisach <epeisach@mit.edu>
Thu, 21 Jun 2001 13:39:10 +0000 (13:39 +0000)
committerEzra Peisach <epeisach@mit.edu>
Thu, 21 Jun 2001 13:39:10 +0000 (13:39 +0000)
        recno/rec_put.c: Change local variable index to idx.

        * hash/hash_page.c: Change local variable stat to status to
        prevent shadowing system function.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13437 dc483132-0cff-0310-8789-dd5450dbe970

src/util/db2/ChangeLog
src/util/db2/btree/bt_delete.c
src/util/db2/btree/bt_put.c
src/util/db2/hash/hash_page.c
src/util/db2/recno/rec_delete.c
src/util/db2/recno/rec_put.c

index 4bbfcbd676984160c6ec474dc968eeab66ba1088..9b1c675fc7d0a20a73aeb7b9b3388d001c0bc9c3 100644 (file)
@@ -1,3 +1,11 @@
+2001-06-21  Ezra Peisach  <epeisach@mit.edu>
+
+       * btree/bt_delete.c, btree/bt_put.c, recno/rec_delete.c,
+       recno/rec_put.c: Change local variable index to idx.
+
+       * hash/hash_page.c: Change local variable stat to status to
+       prevent shadowing system function.
+
 2000-11-01  Ezra Peisach  <epeisach@mit.edu>
 
        * configure.in (AC_COMPILE_TYPE): Declare with AC_DEFUN() instead
index 078981c58baed6e7e5c59dac6f0e07787e2894a5..d002a66edd306e0db1423dcc2b89b82be8f45e16 100644 (file)
@@ -150,7 +150,7 @@ __bt_stkacq(t, hp, c)
        EPG *e;
        EPGNO *parent;
        PAGE *h;
-       indx_t index;
+       indx_t idx;
        db_pgno_t pgno;
        recno_t nextpg, prevpg;
        int exact, level;
@@ -188,8 +188,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);
@@ -198,7 +198,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);
 
@@ -208,7 +208,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)
@@ -243,8 +243,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);
@@ -253,7 +253,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. */
@@ -263,8 +263,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)
@@ -382,7 +382,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;
 
@@ -403,8 +403,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 &&
@@ -436,11 +436,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);
                }
@@ -465,17 +465,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;
@@ -486,12 +486,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 &&
@@ -505,18 +505,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);
@@ -530,17 +530,17 @@ __bt_dleaf(t, key, h, index)
  *     t:      tree
  *    key:     referenced key (or NULL)
  *     h:      page
- *  index:     index on page to delete
+ *  idx:       idx 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;
@@ -563,7 +563,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);
@@ -571,25 +571,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;
@@ -601,7 +601,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;
@@ -617,7 +617,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);
index 139a7fc36981ecee4fb660c9435609c096b7a9b7..80e0e2a9ddb543f7bf5d4faa6214e9d9f888cb9b 100644 (file)
@@ -74,7 +74,7 @@ __bt_put(dbp, key, data, flags)
        DBT tkey, tdata;
        EPG *e = 0;
        PAGE *h;
-       indx_t index, nxtindex;
+       indx_t idx, nxtindex;
        db_pgno_t pg;
        u_int32_t nbytes;
        int dflags, exact, status;
@@ -153,7 +153,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;
        }
 
@@ -165,7 +165,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
@@ -187,7 +187,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);
                }
@@ -203,35 +203,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;
index 83146606fb584de7f513df9914b1ad0c7a415b97..e25115d3f0308f1be272424fb4b9f9eb99a891d9 100644 (file)
@@ -213,12 +213,12 @@ __get_item_next(hashp, cursorp, key, val, item_info)
        DBT *key, *val;
        ITEM_INFO *item_info;
 {
-       int stat;
+       int status;
 
-       stat = __get_item(hashp, cursorp, key, val, item_info);
+       status = __get_item(hashp, cursorp, key, val, item_info);
        cursorp->ndx++;
        cursorp->pgndx++;
-       return (stat);
+       return (status);
 }
 
 /*
index 35ec7769ac7c43a6683cfec94324fd53e534402b..b69c9ad742cb7afb08493cc9e4b677cce5d18593 100644 (file)
@@ -145,16 +145,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;
@@ -172,7 +172,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);
@@ -185,8 +185,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)
index 25452f15f815d183135bffe354c46d48aa1b6296..e7fa75882f2544e6c0336bdccf603305adc4cf94 100644 (file)
@@ -196,7 +196,7 @@ __rec_iput(t, nrec, data, flags)
        DBT tdata;
        EPG *e;
        PAGE *h;
-       indx_t index, nxtindex;
+       indx_t idx, nxtindex;
        db_pgno_t pg;
        u_int32_t nbytes;
        int dflags, status;
@@ -227,7 +227,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
@@ -237,13 +237,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);
                }
@@ -257,18 +257,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);