projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69b5756
)
Save 10 bytes or so, last_patch_70 from Vladimir N. Oleynik
author
Glenn L McGrath
<bug1@ihug.co.nz>
Tue, 3 Dec 2002 20:34:36 +0000
(20:34 -0000)
committer
Glenn L McGrath
<bug1@ihug.co.nz>
Tue, 3 Dec 2002 20:34:36 +0000
(20:34 -0000)
libbb/last_char_is.c
patch
|
blob
|
history
diff --git
a/libbb/last_char_is.c
b/libbb/last_char_is.c
index 4e2ee92ed9a71a2231a4bdafeaef1062e972ea98..9bd70996c03f362833f6f49748579069dd8545e3 100644
(file)
--- a/
libbb/last_char_is.c
+++ b/
libbb/last_char_is.c
@@
-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;
}