diff options
Diffstat (limited to 'src/lib/libc/string/memchr.c')
| -rw-r--r-- | src/lib/libc/string/memchr.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/lib/libc/string/memchr.c b/src/lib/libc/string/memchr.c index 61652c6bb1..454abcbc17 100644 --- a/src/lib/libc/string/memchr.c +++ b/src/lib/libc/string/memchr.c | |||
| @@ -13,11 +13,7 @@ | |||
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. Neither the name of the University nor the names of its contributors |
| 17 | * must display the following acknowledgement: | ||
| 18 | * This product includes software developed by the University of | ||
| 19 | * California, Berkeley and its contributors. | ||
| 20 | * 4. Neither the name of the University nor the names of its contributors | ||
| 21 | * may be used to endorse or promote products derived from this software | 17 | * may be used to endorse or promote products derived from this software |
| 22 | * without specific prior written permission. | 18 | * without specific prior written permission. |
| 23 | * | 19 | * |
| @@ -35,23 +31,19 @@ | |||
| 35 | */ | 31 | */ |
| 36 | 32 | ||
| 37 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
| 38 | /*static char *sccsid = "from: @(#)memchr.c 5.6 (Berkeley) 1/26/91";*/ | 34 | static char *rcsid = "$OpenBSD: memchr.c,v 1.6 2003/06/11 21:08:16 deraadt Exp $"; |
| 39 | static char *rcsid = "$Id: memchr.c,v 1.1.1.1 1995/10/18 08:42:21 deraadt Exp $"; | ||
| 40 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
| 41 | 36 | ||
| 42 | #include <string.h> | 37 | #include <string.h> |
| 43 | 38 | ||
| 44 | void * | 39 | void * |
| 45 | memchr(s, c, n) | 40 | memchr(const void *s, int c, size_t n) |
| 46 | const void *s; | ||
| 47 | register unsigned char c; | ||
| 48 | register size_t n; | ||
| 49 | { | 41 | { |
| 50 | if (n != 0) { | 42 | if (n != 0) { |
| 51 | register const unsigned char *p = s; | 43 | const unsigned char *p = s; |
| 52 | 44 | ||
| 53 | do { | 45 | do { |
| 54 | if (*p++ == c) | 46 | if (*p++ == (unsigned char)c) |
| 55 | return ((void *)(p - 1)); | 47 | return ((void *)(p - 1)); |
| 56 | } while (--n != 0); | 48 | } while (--n != 0); |
| 57 | } | 49 | } |
