From 88ce59ac21e63f73ab2a6f560eedfd546bed9106 Mon Sep 17 00:00:00 2001 From: jkh Date: Wed, 17 Dec 2003 02:46:48 +0000 Subject: Do comparison using appropriate casting first, as per SUSv3 (search for first [last] character, not int). --- lib/libc/string/index.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libc/string/index.c') diff --git a/lib/libc/string/index.c b/lib/libc/string/index.c index c81f95b..fe523be 100644 --- a/lib/libc/string/index.c +++ b/lib/libc/string/index.c @@ -52,8 +52,9 @@ index #endif (const char *p, int ch) { + char c = ch; for (;; ++p) { - if (*p == ch) + if (*p == c) return ((char *)p); if (*p == '\0') return (NULL); -- cgit v1.1