diff options
| author | deraadt <> | 2014-11-30 19:43:57 +0000 |
|---|---|---|
| committer | deraadt <> | 2014-11-30 19:43:57 +0000 |
| commit | d8f66904ee035f3e8b0d2d91fedb956995e16678 (patch) | |
| tree | 82fa98088bf55df432f5bac1dd59e9f100a1cac9 /src/lib/libc/string/bcopy.c | |
| parent | 8189951b402bc1e233818c5f69a8fb4c06ea65b6 (diff) | |
| download | openbsd-d8f66904ee035f3e8b0d2d91fedb956995e16678.tar.gz openbsd-d8f66904ee035f3e8b0d2d91fedb956995e16678.tar.bz2 openbsd-d8f66904ee035f3e8b0d2d91fedb956995e16678.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 '')
| -rw-r--r-- | src/lib/libc/string/bcopy.c | 18 |
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 | ||
| 51 | void * | ||
| 52 | memcpy(void *dst0, const void *src0, size_t length) | ||
| 53 | #else | ||
| 54 | #ifdef MEMMOVE | ||
| 55 | void * | ||
| 56 | memmove(void *dst0, const void *src0, size_t length) | ||
| 57 | #else | ||
| 58 | void | 48 | void |
| 59 | bcopy(const void *src0, void *dst0, size_t length) | 49 | bcopy(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 | } |
| 122 | done: | 110 | done: |
| 123 | #if defined(MEMCOPY) || defined(MEMMOVE) | ||
| 124 | return (dst0); | ||
| 125 | #else | ||
| 126 | return; | 111 | return; |
| 127 | #endif | ||
| 128 | } | 112 | } |
