From 8b3bcfbab9d0a96b133d6076971ea11bfd52e288 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 4 May 2001 17:23:18 +0000 Subject: 2001-05-04 Earnie Boyd * libc/string/strrchr.c: Use strchr for the speed improvements. --- newlib/libc/string/strrchr.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'newlib/libc/string') diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 65160f55e..36ef3ef2f 100644 --- a/newlib/libc/string/strrchr.c +++ b/newlib/libc/string/strrchr.c @@ -41,21 +41,19 @@ _DEFUN (strrchr, (s, i), int i) { _CONST char *last = NULL; - char c = i; - while (*s) + if (i) { - if (*s == c) + while (s=strchr(s, i)) { last = s; + s++; } - s++; } - - if (*s == c) + else { - last = s; + last = strchr(s, i); } - + return (char *) last; } -- cgit v1.2.3