summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/memchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/memchr.c')
-rw-r--r--src/lib/libc/string/memchr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libc/string/memchr.c b/src/lib/libc/string/memchr.c
index 61652c6bb1..d605d4734f 100644
--- a/src/lib/libc/string/memchr.c
+++ b/src/lib/libc/string/memchr.c
@@ -35,8 +35,7 @@
35 */ 35 */
36 36
37#if defined(LIBC_SCCS) && !defined(lint) 37#if defined(LIBC_SCCS) && !defined(lint)
38/*static char *sccsid = "from: @(#)memchr.c 5.6 (Berkeley) 1/26/91";*/ 38static char *rcsid = "$OpenBSD: memchr.c,v 1.4 2001/09/07 08:09:31 espie Exp $";
39static 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 */ 39#endif /* LIBC_SCCS and not lint */
41 40
42#include <string.h> 41#include <string.h>
@@ -44,14 +43,14 @@ static char *rcsid = "$Id: memchr.c,v 1.1.1.1 1995/10/18 08:42:21 deraadt Exp $"
44void * 43void *
45memchr(s, c, n) 44memchr(s, c, n)
46 const void *s; 45 const void *s;
47 register unsigned char c; 46 int c;
48 register size_t n; 47 size_t n;
49{ 48{
50 if (n != 0) { 49 if (n != 0) {
51 register const unsigned char *p = s; 50 const unsigned char *p = s;
52 51
53 do { 52 do {
54 if (*p++ == c) 53 if (*p++ == (unsigned char)c)
55 return ((void *)(p - 1)); 54 return ((void *)(p - 1));
56 } while (--n != 0); 55 } while (--n != 0);
57 } 56 }