diff options
Diffstat (limited to 'newlib/libc')
-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 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; } |