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/ChangeLog | 4 ++++ newlib/libc/string/strrchr.c | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'newlib') diff --git a/newlib/ChangeLog b/newlib/ChangeLog index a58b1ce8b..aaae584a8 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,7 @@ +2001-05-04 Earnie Boyd + + * libc/string/strrchr.c: Use strchr for the speed improvements. + 2001-05-01 Jeff Johnston * libc/stdio/findfp (__sinit)[HAVE_FCNTL]: For platforms that have 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