Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2001-05-04 21:23:18 +0400
committerJeff Johnston <jjohnstn@redhat.com>2001-05-04 21:23:18 +0400
commit8b3bcfbab9d0a96b133d6076971ea11bfd52e288 (patch)
treea28d82670e7ffb02601e602405144fb0d34c26df /newlib
parent69b218bf24d1374876fa900dc75c14532ec1c040 (diff)
2001-05-04 Earnie Boyd <earnie@users.sourceforge.net>
* libc/string/strrchr.c: Use strchr for the speed improvements.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog4
-rw-r--r--newlib/libc/string/strrchr.c14
2 files changed, 10 insertions, 8 deletions
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 <earnie@users.sourceforge.net>
+
+ * libc/string/strrchr.c: Use strchr for the speed improvements.
+
2001-05-01 Jeff Johnston <jjohnstn@redhat.com>
* 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;
}