summaryrefslogtreecommitdiff
path: root/common/lib/libc/string
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2008-03-25 23:13:15 +0000
committerchristos <christos@NetBSD.org>2008-03-25 23:13:15 +0000
commit985a3d11e82e7bc5e4f8ace0771f3ebf01449800 (patch)
tree8ec132bfc980b7dad60903650c615f11f9422ec5 /common/lib/libc/string
parent19d181b7f518059166d5ce7a14b6a192dfe4b1f3 (diff)
add bcopy and bzero for the benefit of loadfile.
Diffstat (limited to 'common/lib/libc/string')
-rw-r--r--common/lib/libc/string/bcopy.c19
-rw-r--r--common/lib/libc/string/memset.c26
2 files changed, 41 insertions, 4 deletions
diff --git a/common/lib/libc/string/bcopy.c b/common/lib/libc/string/bcopy.c
index 7ce9ca0b293..652c059f271 100644
--- a/common/lib/libc/string/bcopy.c
+++ b/common/lib/libc/string/bcopy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bcopy.c,v 1.4 2008/03/25 21:22:37 christos Exp $ */
+/* $NetBSD: bcopy.c,v 1.5 2008/03/25 23:13:15 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: bcopy.c,v 1.4 2008/03/25 21:22:37 christos Exp $");
+__RCSID("$NetBSD: bcopy.c,v 1.5 2008/03/25 23:13:15 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -157,6 +157,21 @@ done:
#endif
}
#else
+#ifdef BCOPY
+/*
+ * This is designed to be small, not fast.
+ */
+void *
+bcopy(const void *s2, void *s1, size_t n)
+{
+ const char *f = s2;
+ char *t = s1;
+
+ while (n-- > 0)
+ *t++ = *f++;
+ return s1;
+}
+#endif
#ifdef MEMCOPY
/*
* This is designed to be small, not fast.
diff --git a/common/lib/libc/string/memset.c b/common/lib/libc/string/memset.c
index b135d985356..4a5f9a3a832 100644
--- a/common/lib/libc/string/memset.c
+++ b/common/lib/libc/string/memset.c
@@ -1,4 +1,4 @@
-/* $NetBSD: memset.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */
+/* $NetBSD: memset.c,v 1.3 2008/03/25 23:13:15 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)memset.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: memset.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+__RCSID("$NetBSD: memset.c,v 1.3 2008/03/25 23:13:15 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -60,6 +60,7 @@ __RCSID("$NetBSD: memset.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
#undef memset
#endif
+#ifndef __OPTIMIZE_SIZE__
#ifdef BZERO
#define RETURN return
#define VAL 0
@@ -141,3 +142,24 @@ memset(void *dst0, int c0, size_t length)
} while (--t != 0);
RETURN;
}
+#else
+#ifdef BZERO
+void
+bzero(void *dstv, size_t length)
+{
+ u_char *dst = dstv;
+ while (length-- > 0)
+ *dst++ = 0;
+}
+#endif
+#ifdef MEMSET
+void *
+memset(void *dstv, int c, size_t length)
+{
+ u_char *dst = dstv;
+ while (length-- > 0)
+ *dst++ = c;
+ return *dst;
+}
+#endif
+#endif