Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Add a small version of memmove() for libsa.
details: https://anonhg.NetBSD.org/src/rev/e082e6d6ac28
branches: trunk
changeset: 514416:e082e6d6ac28
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Sep 02 07:04:16 2001 +0000
description:
Add a small version of memmove() for libsa.
Mostly identical with libsa/bcopy.c.
diffstat:
sys/lib/libsa/Makefile | 4 +-
sys/lib/libsa/memmove.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
sys/lib/libsa/stand.h | 3 +-
3 files changed, 66 insertions(+), 3 deletions(-)
diffs (101 lines):
diff -r c1fac5ed426e -r e082e6d6ac28 sys/lib/libsa/Makefile
--- a/sys/lib/libsa/Makefile Sun Sep 02 06:51:15 2001 +0000
+++ b/sys/lib/libsa/Makefile Sun Sep 02 07:04:16 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.44 2001/03/31 09:45:11 hubertf Exp $
+# $NetBSD: Makefile,v 1.45 2001/09/02 07:04:16 tsutsui Exp $
LIB= sa
MKPIC= no
@@ -18,7 +18,7 @@
# stand routines
SRCS+= alloc.c bcmp.c bcopy.c bzero.c errno.c exit.c exec.c getfile.c gets.c \
- globals.c memcmp.c memcpy.c memset.c panic.c printf.c \
+ globals.c memcmp.c memcpy.c memmove.c memset.c panic.c printf.c \
snprintf.c sprintf.c strerror.c subr_prf.c twiddle.c vsprintf.c \
checkpasswd.c
diff -r c1fac5ed426e -r e082e6d6ac28 sys/lib/libsa/memmove.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libsa/memmove.c Sun Sep 02 07:04:16 2001 +0000
@@ -0,0 +1,62 @@
+/* $NetBSD: memmove.c,v 1.1 2001/09/02 07:04:16 tsutsui Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ * @(#)bcopy.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/types.h>
+#include "stand.h"
+
+/*
+ * This is designed to be small, not fast.
+ */
+void *
+memmove(s1, s2, n)
+ void *s1;
+ const void *s2;
+ size_t n;
+{
+ const char *f = s2;
+ char *t = s1;
+
+ if (f < t) {
+ f += n;
+ t += n;
+ while (n-- > 0)
+ *--t = *--f;
+ } else
+ while (n-- > 0)
+ *t++ = *f++;
+ return (s1);
+}
diff -r c1fac5ed426e -r e082e6d6ac28 sys/lib/libsa/stand.h
--- a/sys/lib/libsa/stand.h Sun Sep 02 06:51:15 2001 +0000
+++ b/sys/lib/libsa/stand.h Sun Sep 02 07:04:16 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stand.h,v 1.42 2001/04/05 04:39:02 thorpej Exp $ */
+/* $NetBSD: stand.h,v 1.43 2001/09/02 07:04:16 tsutsui Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -232,6 +232,7 @@
__dead void _rtt __P((void)) __attribute__((noreturn));
void bcopy __P((const void *, void *, size_t));
void *memcpy __P((void *, const void *, size_t));
+void *memmove __P((void *, const void *, size_t));
int memcmp __P((const void *, const void *, size_t));
void exec __P((char *, char *, int));
int open __P((const char *, int));
Home |
Main Index |
Thread Index |
Old Index