BSD 4_4_Lite1 release
[unix-history] / usr / src / lib / libc / db / btree / bt_overflow.c
index d06769a..0057a03 100644 (file)
@@ -1,15 +1,41 @@
 /*-
 /*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Mike Olson.
  *
  *
  * This code is derived from software contributed to Berkeley by
  * Mike Olson.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_overflow.c      5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)bt_overflow.c      8.2 (Berkeley) 2/21/94";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -62,8 +88,8 @@ __ovfl_get(t, p, ssz, buf, bufsz)
        pgno_t pg;
        size_t nb, plen, sz;
 
        pgno_t pg;
        size_t nb, plen, sz;
 
-       bcopy(p, &pg, sizeof(pgno_t));
-       bcopy((char *)p + sizeof(pgno_t), &sz, sizeof(size_t));
+       memmove(&pg, p, sizeof(pgno_t));
+       memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(size_t));
        *ssz = sz;
 
 #ifdef DEBUG
        *ssz = sz;
 
 #ifdef DEBUG
@@ -72,7 +98,7 @@ __ovfl_get(t, p, ssz, buf, bufsz)
 #endif
        /* Make the buffer bigger as necessary. */
        if (*bufsz < sz) {
 #endif
        /* Make the buffer bigger as necessary. */
        if (*bufsz < sz) {
-               if ((*buf = realloc(*buf, sz)) == NULL)
+               if ((*buf = (char *)realloc(*buf, sz)) == NULL)
                        return (RET_ERROR);
                *bufsz = sz;
        }
                        return (RET_ERROR);
                *bufsz = sz;
        }
@@ -87,7 +113,7 @@ __ovfl_get(t, p, ssz, buf, bufsz)
                        return (RET_ERROR);
 
                nb = MIN(sz, plen);
                        return (RET_ERROR);
 
                nb = MIN(sz, plen);
-               bcopy((char *)h + BTDATAOFF, p, nb);
+               memmove(p, (char *)h + BTDATAOFF, nb);
                mpool_put(t->bt_mp, h, 0);
 
                if ((sz -= nb) == 0)
                mpool_put(t->bt_mp, h, 0);
 
                if ((sz -= nb) == 0)
@@ -134,7 +160,7 @@ __ovfl_put(t, dbt, pg)
                h->lower = h->upper = 0;
 
                nb = MIN(sz, plen);
                h->lower = h->upper = 0;
 
                nb = MIN(sz, plen);
-               bcopy(p, (char *)h + BTDATAOFF, nb);
+               memmove((char *)h + BTDATAOFF, p, nb);
 
                if (last) {
                        last->nextpg = h->pgno;
 
                if (last) {
                        last->nextpg = h->pgno;
@@ -169,8 +195,8 @@ __ovfl_delete(t, p)
        pgno_t pg;
        size_t plen, sz;
 
        pgno_t pg;
        size_t plen, sz;
 
-       bcopy(p, &pg, sizeof(pgno_t));
-       bcopy((char *)p + sizeof(pgno_t), &sz, sizeof(size_t));
+       memmove(&pg, p, sizeof(pgno_t));
+       memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(size_t));
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)