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 * last_char_is(const char *s, int c)
{ {
char *sret; char *sret = (char *)s;
if (!s) if (sret) {
return NULL; sret = strrchr(sret, c);
sret = (char *)s+strlen(s)-1; if(sret != NULL && *(sret+1) != 0)
if (sret>=s && *sret == c) { sret = NULL;
return sret;
} else {
return NULL;
} }
return sret;
} }