diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2001-05-04 17:23:18 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2001-05-04 17:23:18 +0000 |
commit | 8b3bcfbab9d0a96b133d6076971ea11bfd52e288 (patch) | |
tree | a28d82670e7ffb02601e602405144fb0d34c26df /newlib/libc/string/strrchr.c | |
parent | 69b218bf24d1374876fa900dc75c14532ec1c040 (diff) | |
download | newlib-8b3bcfbab9d0a96b133d6076971ea11bfd52e288.zip newlib-8b3bcfbab9d0a96b133d6076971ea11bfd52e288.tar.gz newlib-8b3bcfbab9d0a96b133d6076971ea11bfd52e288.tar.bz2 |
2001-05-04 Earnie Boyd <earnie@users.sourceforge.net>
* libc/string/strrchr.c: Use strchr for the speed improvements.
Diffstat (limited to 'newlib/libc/string/strrchr.c')
-rw-r--r-- | newlib/libc/string/strrchr.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 65160f5..36ef3ef 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; } |