* Ensure that ends_with() actually tests against the end of the string.

This commit is contained in:
Justin Maggard 2009-05-28 16:04:14 +00:00
parent 029928569a
commit 37704b8b8b

View File

@ -29,8 +29,8 @@
int int
ends_with(const char * haystack, const char * needle) ends_with(const char * haystack, const char * needle)
{ {
const char *found = strcasestr(haystack, needle); const char * end = strrchr(haystack, *needle);
return (found && found[strlen(needle)] == '\0'); return (strcasecmp(end?end:"", needle) ? 0 : 1);
} }
char * char *