This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
libc/string/strrchr.c
- To: newlib at sources dot redhat dot com
- Subject: libc/string/strrchr.c
- From: Earnie Boyd <earnie_boyd at yahoo dot com>
- Date: Thu, 03 May 2001 19:35:47 -0400
- Reply-To: newlib at sources dot redhat dot com
This patch improves Cygwin's speed greatly.
Earnie.
2001-05-03 Earnie Boyd <earnie@users.sourceforge.net>
* libc/string/strrchr.c: Use strchr for the speed improvements.
Index: strrchr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/strrchr.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 strrchr.c
--- strrchr.c 2000/02/17 19:39:48 1.1.1.1
+++ strrchr.c 2001/05/03 23:27:52
@@ -41,21 +41,12 @@ _DEFUN (strrchr, (s, i),
int i)
{
_CONST char *last = NULL;
- char c = i;
- while (*s)
+ while (s=strchr(s, i))
{
- if (*s == c)
- {
- last = s;
- }
- s++;
- }
-
- if (*s == c)
- {
last = s;
+ s++;
}
-
+
return (char *) last;
}