/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
*
* @APPLE_LICENSE_HEADER_END@
*/
-/*
- * Copyright (c) 1990, 1993
+/*-
+ * Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* SUCH DAMAGE.
*/
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)bt_overflow.c 8.5 (Berkeley) 7/16/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
#include <sys/param.h>
*
* Parameters:
* t: tree
- * p: pointer to { pgno_t, size_t }
+ * p: pointer to { pgno_t, u_int32_t }
* buf: storage address
* bufsz: storage size
*
BTREE *t;
void *p;
size_t *ssz;
- char **buf;
+ void **buf;
size_t *bufsz;
{
PAGE *h;
pgno_t pg;
- size_t nb, plen, sz;
+ size_t nb, plen;
+ u_int32_t sz;
memmove(&pg, p, sizeof(pgno_t));
- memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(size_t));
+ memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t));
*ssz = sz;
#ifdef DEBUG
#endif
/* Make the buffer bigger as necessary. */
if (*bufsz < sz) {
- if ((*buf = (char *)realloc(*buf, sz)) == NULL)
+ *buf = (char *)(*buf == NULL ? malloc(sz) : reallocf(*buf, sz));
+ if (*buf == NULL)
return (RET_ERROR);
*bufsz = sz;
}
PAGE *h, *last;
void *p;
pgno_t npg;
- size_t nb, plen, sz;
+ size_t nb, plen;
+ u_int32_t sz;
/*
* Allocate pages and copy the key/data record into them. Store the
*
* Parameters:
* t: tree
- * p: pointer to { pgno_t, size_t }
+ * p: pointer to { pgno_t, u_int32_t }
*
* Returns:
* RET_ERROR, RET_SUCCESS
{
PAGE *h;
pgno_t pg;
- size_t plen, sz;
+ size_t plen;
+ u_int32_t sz;
memmove(&pg, p, sizeof(pgno_t));
- memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(size_t));
+ memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t));
#ifdef DEBUG
if (pg == P_INVALID || sz == 0)