/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @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)