]> git.saurik.com Git - apple/libc.git/blobdiff - db/btree/FreeBSD/bt_overflow.c
Libc-825.25.tar.gz
[apple/libc.git] / db / btree / FreeBSD / bt_overflow.c
index 5e0f1ae94d6043a1cf028cfabc73d02cc2795e3c..25e3000159cd04f32f77b6726a1ffbca7163d5de 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[] = "@(#)bt_overflow.c      8.5 (Berkeley) 7/16/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_overflow.c,v 1.3 2002/03/22 21:52:01 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_overflow.c,v 1.6 2009/03/05 00:57:01 delphij Exp $");
 
 #include <sys/param.h>
 
@@ -79,12 +75,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_overflow.c,v 1.3 2002/03/22 21:52:0
  *     RET_ERROR, RET_SUCCESS
  */
 int
-__ovfl_get(t, p, ssz, buf, bufsz)
-       BTREE *t;
-       void *p;
-       size_t *ssz;
-       void **buf;
-       size_t *bufsz;
+__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz)
 {
        PAGE *h;
        pgno_t pg;
@@ -97,11 +88,11 @@ __ovfl_get(t, p, ssz, buf, bufsz)
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)
-               abort();
+               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
 #endif
        /* Make the buffer bigger as necessary. */
        if (*bufsz < sz) {
-               *buf = (char *)(*buf == NULL ? malloc(sz) : reallocf(*buf, sz));
+               *buf = reallocf(*buf, sz);
                if (*buf == NULL)
                        return (RET_ERROR);
                *bufsz = sz;
@@ -138,10 +129,7 @@ __ovfl_get(t, p, ssz, buf, bufsz)
  *     RET_ERROR, RET_SUCCESS
  */
 int
-__ovfl_put(t, dbt, pg)
-       BTREE *t;
-       const DBT *dbt;
-       pgno_t *pg;
+__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg)
 {
        PAGE *h, *last;
        void *p;
@@ -192,9 +180,7 @@ __ovfl_put(t, dbt, pg)
  *     RET_ERROR, RET_SUCCESS
  */
 int
-__ovfl_delete(t, p)
-       BTREE *t;
-       void *p;
+__ovfl_delete(BTREE *t, void *p)
 {
        PAGE *h;
        pgno_t pg;
@@ -206,7 +192,7 @@ __ovfl_delete(t, p)
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)
-               abort();
+               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
 #endif
        if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
                return (RET_ERROR);