Save 10 bytes or so, last_patch_70 from Vladimir N. Oleynik
This commit is contained in:
parent
69b5756594
commit
bf91f2eb1b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user