Save 10 bytes or so, last_patch_70 from Vladimir N. Oleynik

This commit is contained in:
Glenn L McGrath 2002-12-03 20:34:36 +00:00
parent 69b5756594
commit bf91f2eb1b

View File

@ -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;
}