]> git.saurik.com Git - apple/libc.git/blobdiff - db/recno/FreeBSD/rec_delete.c
Libc-1439.100.3.tar.gz
[apple/libc.git] / db / recno / FreeBSD / rec_delete.c
index 12055940487f9bad93e2ecf5ddbce6dba65311a8..f7062d2336ab42edb89462532225944da04e23f0 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)rec_delete.c       8.7 (Berkeley) 7/14/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/recno/rec_delete.c,v 1.2 2002/03/21 22:46:28 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/recno/rec_delete.c,v 1.5 2009/03/03 02:16:12 delphij Exp $");
 
 #include <sys/types.h>
 
@@ -63,10 +59,7 @@ static int rec_rdelete(BTREE *, recno_t);
  *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
  */
 int
-__rec_delete(dbp, key, flags)
-       const DB *dbp;
-       const DBT *key;
-       u_int flags;
+__rec_delete(const DB *dbp, const DBT *key, u_int flags)
 {
        BTREE *t;
        recno_t nrec;
@@ -119,9 +112,7 @@ einval:             errno = EINVAL;
  *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
  */
 static int
-rec_rdelete(t, nrec)
-       BTREE *t;
-       recno_t nrec;
+rec_rdelete(BTREE *t, recno_t nrec)
 {
        EPG *e;
        PAGE *h;
@@ -147,16 +138,13 @@ 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)
-       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;
@@ -174,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);
@@ -187,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)