[BusyBox-cvs] busybox/libbb last_char_is.c,1.5,1.6
Glenn McGrath
bug1 at busybox.net
Tue Dec 3 20:34:39 UTC 2002
Update of /var/cvs/busybox/libbb
In directory winder:/tmp/cvs-serv6741/libbb
Modified Files:
last_char_is.c
Log Message:
Save 10 bytes or so, last_patch_70 from Vladimir N. Oleynik
Index: last_char_is.c
===================================================================
RCS file: /var/cvs/busybox/libbb/last_char_is.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- last_char_is.c 7 Jul 2001 04:27:35 -0000 1.5
+++ last_char_is.c 3 Dec 2002 20:34:36 -0000 1.6
@@ -28,13 +28,11 @@
*/
char * last_char_is(const char *s, int c)
{
- char *sret;
- if (!s)
- return NULL;
- sret = (char *)s+strlen(s)-1;
- if (sret>=s && *sret == c) {
- return sret;
- } else {
- return NULL;
+ char *sret = (char *)s;
+ if (sret) {
+ sret = strrchr(sret, c);
+ if(sret != NULL && *(sret+1) != 0)
+ sret = NULL;
}
+ return sret;
}
More information about the busybox-cvs
mailing list