summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/bcopy.c
diff options
context:
space:
mode:
authorderaadt <>2014-11-30 19:43:57 +0000
committerderaadt <>2014-11-30 19:43:57 +0000
commit3539e3fa3e1f8ac6b4177476a424681e58c76af5 (patch)
tree82fa98088bf55df432f5bac1dd59e9f100a1cac9 /src/lib/libc/string/bcopy.c
parentc65fff479ff8dc713956bcf5d92883f19a479d84 (diff)
downloadopenbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.tar.gz
openbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.tar.bz2
openbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.zip
restructure libc/string + libc/arch/*/string coperation regarding
(potentially) MD versions (function dependent, not filename dependent) split out memcpy/memmove/bcopy and strchr/index/strrchr/rindex Bring back amd64 .S versions And the final touch: switch all architectures temporarily to MI memcpy.c, which contains syslog + abort for overlapping copies. A nice harsh undefined behaviour. We will clean the entire userland of the remaining issues in this catagory, then switch to the optimised memcpy which skips the memmove check. I tried to cut this change into pieces, but testing each sub-step on every architecture is too time consuming and mindnumbing. ok miod
Diffstat (limited to 'src/lib/libc/string/bcopy.c')
-rw-r--r--src/lib/libc/string/bcopy.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/lib/libc/string/bcopy.c b/src/lib/libc/string/bcopy.c
index 4308c6484a..fcaa843c71 100644
--- a/src/lib/libc/string/bcopy.c
+++ b/src/lib/libc/string/bcopy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcopy.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: bcopy.c,v 1.6 2014/11/30 19:43:56 deraadt Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -44,21 +44,9 @@ typedef long word; /* "word" used for optimal copy speed */
44 44
45/* 45/*
46 * Copy a block of memory, handling overlap. 46 * Copy a block of memory, handling overlap.
47 * This is the routine that actually implements
48 * (the portable versions of) bcopy, memcpy, and memmove.
49 */ 47 */
50#ifdef MEMCOPY
51void *
52memcpy(void *dst0, const void *src0, size_t length)
53#else
54#ifdef MEMMOVE
55void *
56memmove(void *dst0, const void *src0, size_t length)
57#else
58void 48void
59bcopy(const void *src0, void *dst0, size_t length) 49bcopy(const void *src0, void *dst0, size_t length)
60#endif
61#endif
62{ 50{
63 char *dst = dst0; 51 char *dst = dst0;
64 const char *src = src0; 52 const char *src = src0;
@@ -120,9 +108,5 @@ bcopy(const void *src0, void *dst0, size_t length)
120 TLOOP(*--dst = *--src); 108 TLOOP(*--dst = *--src);
121 } 109 }
122done: 110done:
123#if defined(MEMCOPY) || defined(MEMMOVE)
124 return (dst0);
125#else
126 return; 111 return;
127#endif
128} 112}